@rentman/rm-core 12.1.2 → 12.1.3

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 (146) hide show
  1. package/changelog.md +1502 -1495
  2. package/dist/rm-core.js +831 -911
  3. package/dist/rm-core.min.js +1 -1
  4. package/dist/types/src/FieldLookupProxy.d.ts +4 -4
  5. package/dist/types/src/classes/ApiFormatter.d.ts +56 -76
  6. package/dist/types/src/classes/ApiRequestService.d.ts +18 -18
  7. package/dist/types/src/classes/ApiResponseProcessor.d.ts +29 -29
  8. package/dist/types/src/classes/BusinessLogicManager/BusinessLogicManager.d.ts +100 -100
  9. package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRule.d.ts +93 -93
  10. package/dist/types/src/classes/BusinessLogicManager/Customfield/CustomFieldTypeBusinessLogicRule.d.ts +17 -17
  11. package/dist/types/src/classes/BusinessLogicManager/Documents/DocumentTemplateBusinessLogicRule.d.ts +24 -24
  12. package/dist/types/src/classes/BusinessLogicManager/Exemplaar/ExemplaarAanschafdatumBusinessLogicRule.d.ts +13 -13
  13. package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurBetalingsconditieBusinessLogicRule.d.ts +19 -19
  14. package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurDatumBusinessLogicRule.d.ts +18 -18
  15. package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurNumberseriesBusinessLogicRule.d.ts +13 -13
  16. package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieNaaminternBusinessLogicRule.d.ts +17 -17
  17. package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieTwowayBusinessLogicRule.d.ts +13 -13
  18. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalTelexemplarenBusinessLogicRule.d.ts +15 -15
  19. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalTypeBusinessLogicRule.d.ts +17 -17
  20. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalVerhuurBusinessLogicRule.d.ts +17 -17
  21. package/dist/types/src/classes/BusinessLogicManager/Materiaal/SurfaceArticleSizeBusinessLogicRule.d.ts +18 -18
  22. package/dist/types/src/classes/BusinessLogicManager/OfferteContract/OfferteContractDatumBusinessLogicRule.d.ts +25 -25
  23. package/dist/types/src/classes/BusinessLogicManager/PlanningPersoneelTransport/PlanningPersoneelTransportBusinessLogicRule.d.ts +28 -28
  24. package/dist/types/src/classes/BusinessLogicManager/Project/ProjectClientNoteBusinessLogicRule.d.ts +22 -22
  25. package/dist/types/src/classes/BusinessLogicManager/Reparatie/ReparatieExemplaarAantalBusinessLogicRule.d.ts +13 -13
  26. package/dist/types/src/classes/BusinessLogicManager/Reparatie/ReparatieExemplaarLocationBusinessLogicRule.d.ts +23 -23
  27. package/dist/types/src/classes/BusinessLogicManager/Rol/RolDocumentAccessBusinessLogicRule.d.ts +17 -17
  28. package/dist/types/src/classes/BusinessLogicManager/Rol/RolEditOwnDataBusinessLogicRule.d.ts +17 -17
  29. package/dist/types/src/classes/BusinessLogicManager/Rol/RolFileAccessBusinessLogicRule.d.ts +17 -17
  30. package/dist/types/src/classes/BusinessLogicManager/Rol/RolPersoneelsplannerToegangBusinessLogicRule.d.ts +17 -17
  31. package/dist/types/src/classes/BusinessLogicManager/Rol/RolProjectenBewerkenBusinessLogicRule.d.ts +17 -17
  32. package/dist/types/src/classes/BusinessLogicManager/Rol/RolProjectenToegangBusinessLogicRule.d.ts +17 -17
  33. package/dist/types/src/classes/CacheSyncer.d.ts +71 -71
  34. package/dist/types/src/classes/ChangesCompilation.d.ts +33 -33
  35. package/dist/types/src/classes/ChangesDelta.d.ts +65 -65
  36. package/dist/types/src/classes/ChangesDeltaBase.d.ts +103 -88
  37. package/dist/types/src/classes/ChangesProcessor.d.ts +40 -40
  38. package/dist/types/src/classes/CollectionEntryService.d.ts +24 -24
  39. package/dist/types/src/classes/CollectionResourceService.d.ts +6 -6
  40. package/dist/types/src/classes/ColumnCache.d.ts +19 -19
  41. package/dist/types/src/classes/ColumnExpansion.d.ts +19 -19
  42. package/dist/types/src/classes/ColumnHandler.d.ts +20 -20
  43. package/dist/types/src/classes/ColumnInfo.d.ts +15 -15
  44. package/dist/types/src/classes/ColumnSet.d.ts +37 -37
  45. package/dist/types/src/classes/ColumnUtil.d.ts +108 -108
  46. package/dist/types/src/classes/ConversionMapService.d.ts +25 -25
  47. package/dist/types/src/classes/CreateRequest.d.ts +17 -17
  48. package/dist/types/src/classes/CreatedChangesDelta.d.ts +17 -17
  49. package/dist/types/src/classes/InternalChangesDelta.d.ts +44 -44
  50. package/dist/types/src/classes/ItemCache.d.ts +27 -27
  51. package/dist/types/src/classes/ItemCreateService.d.ts +18 -18
  52. package/dist/types/src/classes/ItemEntryService.d.ts +32 -32
  53. package/dist/types/src/classes/KeyService.d.ts +18 -18
  54. package/dist/types/src/classes/LockService.d.ts +28 -28
  55. package/dist/types/src/classes/ModuleChangesCompilation.d.ts +17 -17
  56. package/dist/types/src/classes/ParentChangesDelta.d.ts +41 -41
  57. package/dist/types/src/classes/QueryColumnExtractor.d.ts +18 -18
  58. package/dist/types/src/classes/QueryContainsLocalIdParser.d.ts +17 -17
  59. package/dist/types/src/classes/QueryLinkedToParser.d.ts +17 -17
  60. package/dist/types/src/classes/QueryLocallyMatchableParser.d.ts +20 -20
  61. package/dist/types/src/classes/QueryMatcher.d.ts +25 -25
  62. package/dist/types/src/classes/QueryParser.d.ts +25 -25
  63. package/dist/types/src/classes/QueryParserBase.d.ts +20 -20
  64. package/dist/types/src/classes/QueryParserIdUpdater.d.ts +17 -17
  65. package/dist/types/src/classes/QueryService.d.ts +12 -12
  66. package/dist/types/src/classes/RequestBuffer.d.ts +26 -26
  67. package/dist/types/src/classes/RequestBufferManager.d.ts +21 -21
  68. package/dist/types/src/classes/RequestColumnExpansion.d.ts +13 -13
  69. package/dist/types/src/classes/RequestColumnsOperationsCache.d.ts +46 -46
  70. package/dist/types/src/classes/SocketMessageHandler.d.ts +34 -34
  71. package/dist/types/src/classes/TemplateCache.d.ts +64 -64
  72. package/dist/types/src/classes/Util.d.ts +28 -28
  73. package/dist/types/src/classes/cache/AbstractCache.d.ts +85 -85
  74. package/dist/types/src/classes/cache/CachedQueryHandlerBase.d.ts +70 -70
  75. package/dist/types/src/classes/cache/ItemHandlerBase.d.ts +107 -107
  76. package/dist/types/src/classes/cache/server/ServerCache.d.ts +65 -65
  77. package/dist/types/src/classes/cache/server/ServerCachedQueryHandler.d.ts +27 -27
  78. package/dist/types/src/classes/cache/server/ServerItemHandler.d.ts +39 -39
  79. package/dist/types/src/classes/cache/transaction/TransactionCache.d.ts +298 -298
  80. package/dist/types/src/classes/cache/transaction/TransactionCachedQueryHandler.d.ts +50 -50
  81. package/dist/types/src/classes/cache/transaction/TransactionCollectionHandler.d.ts +24 -24
  82. package/dist/types/src/classes/cache/transaction/TransactionEventHandler.d.ts +21 -21
  83. package/dist/types/src/classes/cache/transaction/TransactionItemHandler.d.ts +80 -80
  84. package/dist/types/src/classes/cache/transaction/TransactionValidator.d.ts +33 -33
  85. package/dist/types/src/constants.d.ts +7 -7
  86. package/dist/types/src/core.d.ts +48 -48
  87. package/dist/types/src/factories/ApiResponseProcessorFactory.d.ts +6 -6
  88. package/dist/types/src/factories/CacheSyncerFactory.d.ts +14 -14
  89. package/dist/types/src/factories/ChangesCompilationFactory.d.ts +5 -5
  90. package/dist/types/src/factories/ChangesDeltaFactory.d.ts +13 -13
  91. package/dist/types/src/factories/ChangesProcessorFactory.d.ts +13 -13
  92. package/dist/types/src/factories/CollectionEntryFactory.d.ts +11 -11
  93. package/dist/types/src/factories/CollectionResourceFactory.d.ts +18 -18
  94. package/dist/types/src/factories/ColumnExpansionFactory.d.ts +7 -7
  95. package/dist/types/src/factories/ColumnInfoFactory.d.ts +7 -7
  96. package/dist/types/src/factories/ColumnSetFactory.d.ts +18 -18
  97. package/dist/types/src/factories/CreateRequestFactory.d.ts +9 -9
  98. package/dist/types/src/factories/ItemCacheFactory.d.ts +6 -6
  99. package/dist/types/src/factories/ItemEntryFactory.d.ts +12 -12
  100. package/dist/types/src/factories/ItemResourceFactory.d.ts +11 -11
  101. package/dist/types/src/factories/ModuleChangesCompilationFactory.d.ts +6 -6
  102. package/dist/types/src/factories/QueryMatcherFactory.d.ts +8 -8
  103. package/dist/types/src/factories/QueryParserFactory.d.ts +5 -5
  104. package/dist/types/src/factories/RequestColumnExpansionFactory.d.ts +6 -6
  105. package/dist/types/src/factories/RequestColumnsOperationsCacheFactory.d.ts +8 -8
  106. package/dist/types/src/factories/TemplateFactory.d.ts +8 -8
  107. package/dist/types/src/factories/TransactionCacheFactory.d.ts +13 -13
  108. package/dist/types/src/index.d.ts +1 -1
  109. package/dist/types/src/interfaces/AbstractCacheDependencyInterface.d.ts +38 -38
  110. package/dist/types/src/interfaces/ApiRequestServiceInterface.d.ts +12 -12
  111. package/dist/types/src/interfaces/AuthInterface.d.ts +10 -10
  112. package/dist/types/src/interfaces/ErrorHandlerInterface.d.ts +6 -6
  113. package/dist/types/src/interfaces/ExceptionHandlerInterface.d.ts +3 -3
  114. package/dist/types/src/interfaces/LinkTreeServiceInterface.d.ts +4 -4
  115. package/dist/types/src/interfaces/PromiseLibraryInterface.d.ts +33 -33
  116. package/dist/types/src/interfaces/ServerCacheDependencyInterface.d.ts +5 -5
  117. package/dist/types/src/interfaces/SocketMessageInterface.d.ts +3 -3
  118. package/dist/types/src/interfaces/TransactionCollectionHandlerDependencyInterface.d.ts +17 -17
  119. package/dist/types/src/interfaces/TransactionItemHandlerDependencyInterface.d.ts +22 -22
  120. package/dist/types/src/internal.d.ts +128 -128
  121. package/dist/types/src/models/CachedQueryItem.d.ts +40 -40
  122. package/dist/types/src/models/CollectionEntry.d.ts +22 -22
  123. package/dist/types/src/models/CollectionOptions.d.ts +44 -44
  124. package/dist/types/src/models/CollectionResource.d.ts +87 -87
  125. package/dist/types/src/models/ItemEntry.d.ts +19 -19
  126. package/dist/types/src/models/ItemEntryOptions.d.ts +8 -8
  127. package/dist/types/src/models/ItemResource.d.ts +95 -95
  128. package/dist/types/src/models/Template.d.ts +11 -11
  129. package/dist/types/src/types/ItemTypesCollection.d.ts +361 -361
  130. package/dist/types/src/types/PromiseInterface.d.ts +2 -2
  131. package/dist/types/tests/integration/core.test.d.ts +1 -1
  132. package/dist/types/tests/integration/helpers/helpers.d.ts +32 -32
  133. package/dist/types/tests/integration/transactions/field_lookup.test.d.ts +1 -1
  134. package/dist/types/tests/integration/transactions/get_by.test.d.ts +1 -1
  135. package/dist/types/tests/integration/transactions/updates.test.d.ts +1 -1
  136. package/dist/types/tests/mocks/ApiMocked.d.ts +19 -19
  137. package/dist/types/tests/mocks/PromiseLibrary.mocked.d.ts +2 -2
  138. package/dist/types/tests/regression/RM4_17754.test.d.ts +1 -1
  139. package/dist/types/tests/regression/RM4_18216.test.d.ts +1 -1
  140. package/dist/types/tests/unit/query_contains_local_id_parser.test.d.ts +1 -1
  141. package/dist/types/tests/unit/query_linked_to_parser.test.d.ts +1 -1
  142. package/dist/types/tests/unit/query_matcher.test.d.ts +1 -1
  143. package/dist/types/tests/unit/query_parser_id_updater.test.d.ts +1 -1
  144. package/dist/types/tests/unit/query_service.test.d.ts +1 -1
  145. package/package.json +57 -57
  146. package/readme.md +16 -16
@@ -1,93 +1,93 @@
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 { ChangesDelta } from '../ChangesDelta';
7
- import { ChangesDeltaItemUpdateDelta } from '../ChangesDeltaBase';
8
- export declare type BusinessLogicRuleConfirmFn<ConditionResult = any> = (conditionResult: ConditionResult, changesDelta: ChangesDelta) => Promise<boolean>;
9
- export declare type BusinessLogicConditionResult<ItemTypeType extends ApiEnumItemType, ColumnId extends ItemTypeColumnId<ItemTypeType>> = {
10
- itemEntry: ItemEntry<ItemTypeType>;
11
- responseColumn: ResponseColumn<ItemTypeType, ColumnId>;
12
- oldValue: GetFieldValueType<ItemTypeType, ColumnId>;
13
- newValue: GetFieldValueType<ItemTypeType, ColumnId>;
14
- };
15
- /**
16
- * @description
17
- * A business rule is a class that does some data transformation depending on other fields.
18
- * You can hook into any data change using the {@link BusinessLogicRule.condition `condition`} function (also deletes/creates)
19
- *
20
- * All business rule logic is always run in these phases:
21
- * 1. condition checking - handled by the {@link BusinessLogicRule.condition `condition`} function
22
- * 2. dependency fetching - handled by the {@link BusinessLogicRule.dependency `dependency`} function
23
- * 3. rule applying - handled by the {@link BusinessLogicRule.apply `apply`} function
24
- */
25
- export declare abstract class BusinessLogicRule<ConditionResult extends any = any, DependencyType extends any = any> {
26
- protected apiFormatter: ApiFormatter;
27
- confirmFn: null | BusinessLogicRuleConfirmFn<ConditionResult>;
28
- constructor(apiFormatter: ApiFormatter);
29
- /**
30
- * @description
31
- * 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.
32
- *
33
- * @param transaction
34
- * @param changesDelta The changesDelta that is being applied
35
- */
36
- checkCondition(transaction: TransactionCache, changesDelta: ChangesDelta): Promise<ConditionResult | undefined>;
37
- /**
38
- * @description
39
- * The {@link BusinessLogicRule.dependency `dependency`} function gets the result of the {@link BusinessLogicRule.condition `condition`} function and has to ensure that
40
- * the data that the {@link BusinessLogicRule.apply `apply`} function reads/writes is fetched (because you cannot write columns you don't have)
41
- *
42
- * @param transaction The transaction that the delta is being applied on
43
- * @param conditionResult The result of the {@link BusinessLogicRule.condition `condition`} call
44
- * @param changesDelta The source changesDelta that triggered the business rule
45
- */
46
- abstract dependency(transaction: TransactionCache, conditionResult: ConditionResult, changesDelta: ChangesDelta): Promise<DependencyType>;
47
- /**
48
- * @description
49
- * 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
50
- * In this function other fields can be updated or new items can be created
51
- *
52
- * @remark
53
- * 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.
54
- *
55
- * @param changesDelta The source changesDelta that triggered the business rule
56
- * @param destinationChangesDelta The destination changesDelta on which you should put the new changes you want to add
57
- * @param dependencies The result of the {@link BusinessLogicRule.dependency `dependency`} function
58
- * @param transaction The transaction that the delta is being applied on
59
- */
60
- abstract apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, dependencies: DependencyType, transaction: TransactionCache): Promise<any> | void;
61
- /**
62
- * @description
63
- * 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.
64
- * This function can return `undefined` if the rule does not apply to the items in the given ChangesDelta.
65
- *
66
- * @param transaction
67
- * @param changesDelta The source changesDelta that triggered the business rule
68
- * @protected
69
- */
70
- protected abstract condition(changesDelta: ChangesDelta, transaction: TransactionCache): ConditionResult | undefined;
71
- /**
72
- * @description
73
- * 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
74
- *
75
- * @param transaction
76
- * @param changesDelta The source changesDelta that triggered the business rule
77
- * @param itemType The ItemType of the item you want to compare a field from
78
- * @param columnId The columnId of the field that should've been changed for the ID to be included
79
- * @protected
80
- */
81
- protected getItemIdsWithUpdatedField<ItemTypeType extends ApiEnumItemType>(transaction: TransactionCache, changesDelta: ChangesDelta, itemType: ItemTypeType, columnId: keyof FieldMap<ItemTypeType>): ItemId[] | undefined;
82
- /**
83
- * @description
84
- * This function will compare the stored changes with the given changes, and return a {@link BusinessLogicConditionResult} if the fields have been changed, null otherwise.
85
- * If either the source or changed field is `undefined` it will always return `null` (not changed)
86
- *
87
- * @param transaction
88
- * @param tuple The {@link ChangesDelta.updated update tuple} from a ChangesDelta
89
- * @param columnId The columnId of the field that should've been changed for the ID to be included
90
- * @protected
91
- */
92
- protected fieldChanged<ItemTypeType extends ApiEnumItemType, ColumnId extends ItemTypeColumnId<ItemTypeType>>(transaction: TransactionCache, tuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, columnId: ColumnId): null | BusinessLogicConditionResult<ItemTypeType, ColumnId>;
93
- }
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 { ChangesDelta } from '../ChangesDelta';
7
+ import { ChangesDeltaItemUpdateDelta } from '../ChangesDeltaBase';
8
+ export declare type BusinessLogicRuleConfirmFn<ConditionResult = any> = (conditionResult: ConditionResult, changesDelta: ChangesDelta) => Promise<boolean>;
9
+ export declare type BusinessLogicConditionResult<ItemTypeType extends ApiEnumItemType, ColumnId extends ItemTypeColumnId<ItemTypeType>> = {
10
+ itemEntry: ItemEntry<ItemTypeType>;
11
+ responseColumn: ResponseColumn<ItemTypeType, ColumnId>;
12
+ oldValue: GetFieldValueType<ItemTypeType, ColumnId>;
13
+ newValue: GetFieldValueType<ItemTypeType, ColumnId>;
14
+ };
15
+ /**
16
+ * @description
17
+ * A business rule is a class that does some data transformation depending on other fields.
18
+ * You can hook into any data change using the {@link BusinessLogicRule.condition `condition`} function (also deletes/creates)
19
+ *
20
+ * All business rule logic is always run in these phases:
21
+ * 1. condition checking - handled by the {@link BusinessLogicRule.condition `condition`} function
22
+ * 2. dependency fetching - handled by the {@link BusinessLogicRule.dependency `dependency`} function
23
+ * 3. rule applying - handled by the {@link BusinessLogicRule.apply `apply`} function
24
+ */
25
+ export declare abstract class BusinessLogicRule<ConditionResult extends any = any, DependencyType extends any = any> {
26
+ protected apiFormatter: ApiFormatter;
27
+ confirmFn: null | BusinessLogicRuleConfirmFn<ConditionResult>;
28
+ constructor(apiFormatter: ApiFormatter);
29
+ /**
30
+ * @description
31
+ * 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.
32
+ *
33
+ * @param transaction
34
+ * @param changesDelta The changesDelta that is being applied
35
+ */
36
+ checkCondition(transaction: TransactionCache, changesDelta: ChangesDelta): Promise<ConditionResult | undefined>;
37
+ /**
38
+ * @description
39
+ * The {@link BusinessLogicRule.dependency `dependency`} function gets the result of the {@link BusinessLogicRule.condition `condition`} function and has to ensure that
40
+ * the data that the {@link BusinessLogicRule.apply `apply`} function reads/writes is fetched (because you cannot write columns you don't have)
41
+ *
42
+ * @param transaction The transaction that the delta is being applied on
43
+ * @param conditionResult The result of the {@link BusinessLogicRule.condition `condition`} call
44
+ * @param changesDelta The source changesDelta that triggered the business rule
45
+ */
46
+ abstract dependency(transaction: TransactionCache, conditionResult: ConditionResult, changesDelta: ChangesDelta): Promise<DependencyType>;
47
+ /**
48
+ * @description
49
+ * 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
50
+ * In this function other fields can be updated or new items can be created
51
+ *
52
+ * @remark
53
+ * 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.
54
+ *
55
+ * @param changesDelta The source changesDelta that triggered the business rule
56
+ * @param destinationChangesDelta The destination changesDelta on which you should put the new changes you want to add
57
+ * @param dependencies The result of the {@link BusinessLogicRule.dependency `dependency`} function
58
+ * @param transaction The transaction that the delta is being applied on
59
+ */
60
+ abstract apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, dependencies: DependencyType, transaction: TransactionCache): Promise<any> | void;
61
+ /**
62
+ * @description
63
+ * 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.
64
+ * This function can return `undefined` if the rule does not apply to the items in the given ChangesDelta.
65
+ *
66
+ * @param transaction
67
+ * @param changesDelta The source changesDelta that triggered the business rule
68
+ * @protected
69
+ */
70
+ protected abstract condition(changesDelta: ChangesDelta, transaction: TransactionCache): ConditionResult | undefined;
71
+ /**
72
+ * @description
73
+ * 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
74
+ *
75
+ * @param transaction
76
+ * @param changesDelta The source changesDelta that triggered the business rule
77
+ * @param itemType The ItemType of the item you want to compare a field from
78
+ * @param columnId The columnId of the field that should've been changed for the ID to be included
79
+ * @protected
80
+ */
81
+ protected getItemIdsWithUpdatedField<ItemTypeType extends ApiEnumItemType>(transaction: TransactionCache, changesDelta: ChangesDelta, itemType: ItemTypeType, columnId: keyof FieldMap<ItemTypeType>): ItemId[] | undefined;
82
+ /**
83
+ * @description
84
+ * This function will compare the stored changes with the given changes, and return a {@link BusinessLogicConditionResult} if the fields have been changed, null otherwise.
85
+ * If either the source or changed field is `undefined` it will always return `null` (not changed)
86
+ *
87
+ * @param transaction
88
+ * @param tuple The {@link ChangesDelta.updated update tuple} from a ChangesDelta
89
+ * @param columnId The columnId of the field that should've been changed for the ID to be included
90
+ * @protected
91
+ */
92
+ protected fieldChanged<ItemTypeType extends ApiEnumItemType, ColumnId extends ItemTypeColumnId<ItemTypeType>>(transaction: TransactionCache, tuple: ChangesDeltaItemUpdateDelta<ItemTypeType>, columnId: ColumnId): null | BusinessLogicConditionResult<ItemTypeType, ColumnId>;
93
+ }
@@ -1,17 +1,17 @@
1
- import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
- import { ItemResource } from '../../../models/ItemResource';
3
- import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
- import { ChangesDelta } from '../../ChangesDelta';
5
- import { BusinessLogicRule } from '../BusinessLogicRule';
6
- declare type ConditionResult = ItemId[];
7
- declare type Dependency = ItemResource<ApiEnumItemType.Customfield, ['defaultvalue', 'attributes']>[];
8
- /**
9
- * @description
10
- * If the 'type' field changes we reset the 'defaultvalue' and 'attribute' fields so that they do not contain invalid values
11
- */
12
- export declare class CustomFieldTypeBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
13
- condition(changesDelta: ChangesDelta, transaction: TransactionCache): ConditionResult | undefined;
14
- dependency(transaction: TransactionCache, functionIds: ConditionResult): Promise<Dependency>;
15
- apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, customFieldResources: Dependency): void;
16
- }
17
- export {};
1
+ import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { ChangesDelta } from '../../ChangesDelta';
5
+ import { BusinessLogicRule } from '../BusinessLogicRule';
6
+ declare type ConditionResult = ItemId[];
7
+ declare type Dependency = ItemResource<ApiEnumItemType.Customfield, ['defaultvalue', 'attributes']>[];
8
+ /**
9
+ * @description
10
+ * If the 'type' field changes we reset the 'defaultvalue' and 'attribute' fields so that they do not contain invalid values
11
+ */
12
+ export declare class CustomFieldTypeBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
13
+ condition(changesDelta: ChangesDelta, transaction: TransactionCache): ConditionResult | undefined;
14
+ dependency(transaction: TransactionCache, functionIds: ConditionResult): Promise<Dependency>;
15
+ apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, customFieldResources: Dependency): void;
16
+ }
17
+ export {};
@@ -1,24 +1,24 @@
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 { ChangesDelta } from '../../ChangesDelta';
7
- import { BusinessLogicRule } from '../BusinessLogicRule';
8
- declare type DocumentTypes = ApiEnumItemType.Factuur | ApiEnumItemType.Offerte | ApiEnumItemType.Contract | ApiEnumItemType.Bon | ApiEnumItemType.Inhuurbon | ApiEnumItemType.Materiaalbon | ApiEnumItemType.Medewerkerbon | ApiEnumItemType.Aanmaning | ApiEnumItemType.Reparatiebon | ApiEnumItemType.Voertuigbon;
9
- declare type ConditionResult = {
10
- [key in DocumentTypes]?: ItemId[];
11
- };
12
- declare type Dependency = {
13
- [key in DocumentTypes]?: ItemResource<DocumentTypes, ['filename', 'betreft']>[];
14
- };
15
- export declare class DocumentTemplateBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
16
- protected apiFormatter: ApiFormatter;
17
- private promiseLibrary;
18
- constructor(apiFormatter: ApiFormatter, promiseLibrary: PromiseLibraryInterface);
19
- condition(changesDelta: ChangesDelta, transaction: TransactionCache): ConditionResult | undefined;
20
- dependency(transaction: TransactionCache, itemIdMap: ConditionResult): Promise<Dependency>;
21
- apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, items: Dependency): void;
22
- private isDocumentType;
23
- }
24
- 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 { ChangesDelta } from '../../ChangesDelta';
7
+ import { BusinessLogicRule } from '../BusinessLogicRule';
8
+ declare type DocumentTypes = ApiEnumItemType.Factuur | ApiEnumItemType.Offerte | ApiEnumItemType.Contract | ApiEnumItemType.Bon | ApiEnumItemType.Inhuurbon | ApiEnumItemType.Materiaalbon | ApiEnumItemType.Medewerkerbon | ApiEnumItemType.Aanmaning | ApiEnumItemType.Reparatiebon | ApiEnumItemType.Voertuigbon;
9
+ declare type ConditionResult = {
10
+ [key in DocumentTypes]?: ItemId[];
11
+ };
12
+ declare type Dependency = {
13
+ [key in DocumentTypes]?: ItemResource<DocumentTypes, ['filename', 'betreft']>[];
14
+ };
15
+ export declare class DocumentTemplateBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
16
+ protected apiFormatter: ApiFormatter;
17
+ private promiseLibrary;
18
+ constructor(apiFormatter: ApiFormatter, promiseLibrary: PromiseLibraryInterface);
19
+ condition(changesDelta: ChangesDelta, transaction: TransactionCache): ConditionResult | undefined;
20
+ dependency(transaction: TransactionCache, itemIdMap: ConditionResult): Promise<Dependency>;
21
+ apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, items: Dependency): void;
22
+ private isDocumentType;
23
+ }
24
+ export {};
@@ -1,13 +1,13 @@
1
- import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
- import { ItemResource } from '../../../models/ItemResource';
3
- import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
- import { ChangesDelta } from '../../ChangesDelta';
5
- import { BusinessLogicRule } from '../BusinessLogicRule';
6
- declare type ConditionResult = ItemId[];
7
- declare type Dependency = ItemResource<ApiEnumItemType.Exemplaar, ['actief']>[];
8
- export declare class ExemplaarAanschafdatumBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
9
- condition(changesDelta: ChangesDelta): ConditionResult | undefined;
10
- dependency(transaction: TransactionCache, exemplaarIds: ConditionResult): Promise<Dependency>;
11
- apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, exemplaarResources: Dependency): void;
12
- }
13
- export {};
1
+ import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { ChangesDelta } from '../../ChangesDelta';
5
+ import { BusinessLogicRule } from '../BusinessLogicRule';
6
+ declare type ConditionResult = ItemId[];
7
+ declare type Dependency = ItemResource<ApiEnumItemType.Exemplaar, ['actief']>[];
8
+ export declare class ExemplaarAanschafdatumBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
9
+ condition(changesDelta: ChangesDelta): ConditionResult | undefined;
10
+ dependency(transaction: TransactionCache, exemplaarIds: ConditionResult): Promise<Dependency>;
11
+ apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, exemplaarResources: Dependency): void;
12
+ }
13
+ 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 { ChangesDelta } from '../../ChangesDelta';
5
- import { BusinessLogicConditionResult, BusinessLogicRule } from '../BusinessLogicRule';
6
- declare type ConditionResult = BusinessLogicConditionResult<ApiEnumItemType.Factuur, 'betalingsconditie'>[];
7
- declare type Dependency = {
8
- Factuur: ItemResource<ApiEnumItemType.Factuur, ['vervaldatum', 'datum']>[];
9
- Betalingsconditie: {
10
- [conditieId: string]: ItemResource<ApiEnumItemType.Betalingsconditie, ['dagen']>;
11
- };
12
- defaultPaymentConditionId: ItemId | null;
13
- };
14
- export declare class FactuurBetalingsconditieBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
15
- condition(changesDelta: ChangesDelta, transaction: TransactionCache): ConditionResult | undefined;
16
- dependency(transaction: TransactionCache, result: 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 { ChangesDelta } from '../../ChangesDelta';
5
+ import { BusinessLogicConditionResult, BusinessLogicRule } from '../BusinessLogicRule';
6
+ declare type ConditionResult = BusinessLogicConditionResult<ApiEnumItemType.Factuur, 'betalingsconditie'>[];
7
+ declare type Dependency = {
8
+ Factuur: ItemResource<ApiEnumItemType.Factuur, ['vervaldatum', 'datum']>[];
9
+ Betalingsconditie: {
10
+ [conditieId: string]: ItemResource<ApiEnumItemType.Betalingsconditie, ['dagen']>;
11
+ };
12
+ defaultPaymentConditionId: ItemId | null;
13
+ };
14
+ export declare class FactuurBetalingsconditieBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
15
+ condition(changesDelta: ChangesDelta, transaction: TransactionCache): ConditionResult | undefined;
16
+ dependency(transaction: TransactionCache, result: ConditionResult, changesDelta: ChangesDelta): Promise<Dependency>;
17
+ apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, deps: Dependency): void;
18
+ }
19
+ 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 { ChangesDelta } from '../../ChangesDelta';
5
- import { BusinessLogicRule } from '../BusinessLogicRule';
6
- declare type ConditionResult = ItemId[];
7
- declare type Dependency = {
8
- Factuur: ItemResource<ApiEnumItemType.Factuur, ['vervaldatum', 'betalingsconditie']>[];
9
- Betalingsconditie: {
10
- [conditieId: string]: ItemResource<ApiEnumItemType.Betalingsconditie, ['dagen']>;
11
- };
12
- };
13
- export declare class FactuurDatumBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
14
- condition(changesDelta: ChangesDelta, transaction: TransactionCache): ConditionResult | undefined;
15
- dependency(transaction: TransactionCache, factuurIds: ConditionResult, _changesDelta: ChangesDelta): Promise<Dependency>;
16
- apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, deps: 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 { ChangesDelta } from '../../ChangesDelta';
5
+ import { BusinessLogicRule } from '../BusinessLogicRule';
6
+ declare type ConditionResult = ItemId[];
7
+ declare type Dependency = {
8
+ Factuur: ItemResource<ApiEnumItemType.Factuur, ['vervaldatum', 'betalingsconditie']>[];
9
+ Betalingsconditie: {
10
+ [conditieId: string]: ItemResource<ApiEnumItemType.Betalingsconditie, ['dagen']>;
11
+ };
12
+ };
13
+ export declare class FactuurDatumBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
14
+ condition(changesDelta: ChangesDelta, transaction: TransactionCache): ConditionResult | undefined;
15
+ dependency(transaction: TransactionCache, factuurIds: ConditionResult, _changesDelta: ChangesDelta): Promise<Dependency>;
16
+ apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, deps: Dependency): void;
17
+ }
18
+ export {};
@@ -1,13 +1,13 @@
1
- import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
- import { ItemResource } from '../../../models/ItemResource';
3
- import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
- import { ChangesDelta } from '../../ChangesDelta';
5
- import { BusinessLogicRule } from '../BusinessLogicRule';
6
- declare type ConditionResult = ItemId[];
7
- declare type Dependency = ItemResource<ApiEnumItemType.Factuur, ['nummer']>[];
8
- export declare class FactuurNumberseriesBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
9
- condition(changesDelta: ChangesDelta, transaction: TransactionCache): ConditionResult | undefined;
10
- dependency(transaction: TransactionCache, factuurIds: ConditionResult): Promise<Dependency>;
11
- apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, factuurResources: Dependency): void;
12
- }
13
- export {};
1
+ import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { ChangesDelta } from '../../ChangesDelta';
5
+ import { BusinessLogicRule } from '../BusinessLogicRule';
6
+ declare type ConditionResult = ItemId[];
7
+ declare type Dependency = ItemResource<ApiEnumItemType.Factuur, ['nummer']>[];
8
+ export declare class FactuurNumberseriesBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
9
+ condition(changesDelta: ChangesDelta, transaction: TransactionCache): ConditionResult | undefined;
10
+ dependency(transaction: TransactionCache, factuurIds: ConditionResult): Promise<Dependency>;
11
+ apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, factuurResources: Dependency): void;
12
+ }
13
+ export {};
@@ -1,17 +1,17 @@
1
- import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
- import { ItemResource } from '../../../models/ItemResource';
3
- import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
- import { ChangesDelta } from '../../ChangesDelta';
5
- import { BusinessLogicRule } from '../BusinessLogicRule';
6
- declare type ConditionResult = ItemId[];
7
- declare type Dependency = ItemResource<ApiEnumItemType.Functie, ['naamintern']>[];
8
- /**
9
- * @description
10
- * If the `naamofferte` is set and the user hasn't filled in a `naamintern` we sync the fields
11
- */
12
- export declare class FunctieNaaminternBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
13
- condition(changesDelta: ChangesDelta, transaction: TransactionCache): ConditionResult | undefined;
14
- dependency(transaction: TransactionCache, functionIds: ConditionResult): Promise<Dependency>;
15
- apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, functionResources: Dependency): void;
16
- }
17
- export {};
1
+ import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { ChangesDelta } from '../../ChangesDelta';
5
+ import { BusinessLogicRule } from '../BusinessLogicRule';
6
+ declare type ConditionResult = ItemId[];
7
+ declare type Dependency = ItemResource<ApiEnumItemType.Functie, ['naamintern']>[];
8
+ /**
9
+ * @description
10
+ * If the `naamofferte` is set and the user hasn't filled in a `naamintern` we sync the fields
11
+ */
12
+ export declare class FunctieNaaminternBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
13
+ condition(changesDelta: ChangesDelta, transaction: TransactionCache): ConditionResult | undefined;
14
+ dependency(transaction: TransactionCache, functionIds: ConditionResult): Promise<Dependency>;
15
+ apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, functionResources: Dependency): void;
16
+ }
17
+ export {};
@@ -1,13 +1,13 @@
1
- import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
- import { ItemResource } from '../../../models/ItemResource';
3
- import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
- import { ChangesDelta } from '../../ChangesDelta';
5
- import { BusinessLogicRule } from '../BusinessLogicRule';
6
- declare type ConditionResult = ItemId[];
7
- declare type Dependency = ItemResource<ApiEnumItemType.Functie, ['afstand']>[];
8
- export declare class FunctieTwowayBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
9
- condition(changesDelta: ChangesDelta, transaction: TransactionCache): ConditionResult | undefined;
10
- dependency(transaction: TransactionCache, functionIds: ConditionResult): Promise<Dependency>;
11
- apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, functionResources: Dependency): void;
12
- }
13
- export {};
1
+ import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { ChangesDelta } from '../../ChangesDelta';
5
+ import { BusinessLogicRule } from '../BusinessLogicRule';
6
+ declare type ConditionResult = ItemId[];
7
+ declare type Dependency = ItemResource<ApiEnumItemType.Functie, ['afstand']>[];
8
+ export declare class FunctieTwowayBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
9
+ condition(changesDelta: ChangesDelta, transaction: TransactionCache): ConditionResult | undefined;
10
+ dependency(transaction: TransactionCache, functionIds: ConditionResult): Promise<Dependency>;
11
+ apply(changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, functionResources: Dependency): void;
12
+ }
13
+ 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,17 +1,17 @@
1
- import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
- import { ItemResource } from '../../../models/ItemResource';
3
- import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
- import { ChangesDelta } from '../../ChangesDelta';
5
- import { BusinessLogicRule } from '../BusinessLogicRule';
6
- declare type ConditionResult = ItemId[];
7
- declare type Dependency = ItemResource<ApiEnumItemType.Materiaal, ['aantal']>[];
8
- /**
9
- * @description
10
- * A sales item can never be a case, so if the user changes the item to a case we make it a rental item
11
- */
12
- export declare class MateriaalTypeBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
13
- condition(changesDelta: ChangesDelta): ConditionResult | undefined;
14
- dependency(transaction: TransactionCache, materiaalIds: ConditionResult): Promise<Dependency>;
15
- apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, materiaalResources: Dependency): void;
16
- }
17
- export {};
1
+ import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { ChangesDelta } from '../../ChangesDelta';
5
+ import { BusinessLogicRule } from '../BusinessLogicRule';
6
+ declare type ConditionResult = ItemId[];
7
+ declare type Dependency = ItemResource<ApiEnumItemType.Materiaal, ['aantal']>[];
8
+ /**
9
+ * @description
10
+ * A sales item can never be a case, so if the user changes the item to a case we make it a rental item
11
+ */
12
+ export declare class MateriaalTypeBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
13
+ condition(changesDelta: ChangesDelta): ConditionResult | undefined;
14
+ dependency(transaction: TransactionCache, materiaalIds: ConditionResult): Promise<Dependency>;
15
+ apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, materiaalResources: Dependency): void;
16
+ }
17
+ export {};
@@ -1,17 +1,17 @@
1
- import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
- import { ItemResource } from '../../../models/ItemResource';
3
- import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
- import { ChangesDelta } from '../../ChangesDelta';
5
- import { BusinessLogicRule } from '../BusinessLogicRule';
6
- declare type ConditionResult = ItemId[];
7
- declare type Dependency = ItemResource<ApiEnumItemType.Materiaal, ['aantal']>[];
8
- /**
9
- * @description
10
- * A sales item can never be a case, so if it is we reset it to an item
11
- */
12
- export declare class MateriaalVerhuurBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
13
- condition(changesDelta: ChangesDelta): ConditionResult | undefined;
14
- dependency(transaction: TransactionCache, materiaalIds: ConditionResult): Promise<Dependency>;
15
- apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, materiaalResources: Dependency): void;
16
- }
17
- export {};
1
+ import { ApiEnumItemType, ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { ChangesDelta } from '../../ChangesDelta';
5
+ import { BusinessLogicRule } from '../BusinessLogicRule';
6
+ declare type ConditionResult = ItemId[];
7
+ declare type Dependency = ItemResource<ApiEnumItemType.Materiaal, ['aantal']>[];
8
+ /**
9
+ * @description
10
+ * A sales item can never be a case, so if it is we reset it to an item
11
+ */
12
+ export declare class MateriaalVerhuurBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
13
+ condition(changesDelta: ChangesDelta): ConditionResult | undefined;
14
+ dependency(transaction: TransactionCache, materiaalIds: ConditionResult): Promise<Dependency>;
15
+ apply(_changesDelta: ChangesDelta, destinationChangesDelta: ChangesDelta, materiaalResources: Dependency): void;
16
+ }
17
+ export {};