@rentman/rm-core 0.0.0-RM4-44763

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 (201) hide show
  1. package/dist/rm-core.js +2 -0
  2. package/dist/rm-core.js.map +1 -0
  3. package/dist/types/src/classes/ApiFormatter.d.ts +66 -0
  4. package/dist/types/src/classes/ApiRequestService.d.ts +18 -0
  5. package/dist/types/src/classes/ApiResponseProcessor.d.ts +31 -0
  6. package/dist/types/src/classes/BusinessLogicManager/AantalBusinessLogicRuleBase.d.ts +36 -0
  7. package/dist/types/src/classes/BusinessLogicManager/AantaltotaalBusinessLogicRuleBase.d.ts +60 -0
  8. package/dist/types/src/classes/BusinessLogicManager/Afspraak/AfspraakRecureindBusinessLogicRule.d.ts +5 -0
  9. package/dist/types/src/classes/BusinessLogicManager/Beschikbaarheid/BeschikbaarheidRecureindBusinessLogicRule.d.ts +5 -0
  10. package/dist/types/src/classes/BusinessLogicManager/BusinessLogicManager.d.ts +66 -0
  11. package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRule.d.ts +81 -0
  12. package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRuleApplyContext.d.ts +32 -0
  13. package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRuleConditionContext.d.ts +41 -0
  14. package/dist/types/src/classes/BusinessLogicManager/BusinessLogicRuleContextBase.d.ts +58 -0
  15. package/dist/types/src/classes/BusinessLogicManager/Contact/ContactAddressBusinessLogicRule.d.ts +22 -0
  16. package/dist/types/src/classes/BusinessLogicManager/Customfield/CustomFieldLinkedItemTypeBusinessLogicRule.d.ts +18 -0
  17. package/dist/types/src/classes/BusinessLogicManager/Customfield/CustomFieldTypeBusinessLogicRule.d.ts +18 -0
  18. package/dist/types/src/classes/BusinessLogicManager/DefaultContactPersonUpdateBusinessLogicRule.d.ts +30 -0
  19. package/dist/types/src/classes/BusinessLogicManager/Documents/DocumentTemplateBusinessLogicRule.d.ts +20 -0
  20. package/dist/types/src/classes/BusinessLogicManager/Exemplaar/ExemplaarAanschafdatumBusinessLogicRule.d.ts +14 -0
  21. package/dist/types/src/classes/BusinessLogicManager/Exemplaar/ExemplaarBarcodeDeleteBusinessLogicRule.d.ts +14 -0
  22. package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurBetalingsconditieBusinessLogicRule.d.ts +21 -0
  23. package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurDatumBusinessLogicRule.d.ts +23 -0
  24. package/dist/types/src/classes/BusinessLogicManager/Factuur/FactuurNumberseriesBusinessLogicRule.d.ts +14 -0
  25. package/dist/types/src/classes/BusinessLogicManager/Files/FilesNameExtensionBusinessLogicRule.d.ts +20 -0
  26. package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieNaaminternBusinessLogicRule.d.ts +18 -0
  27. package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieRecureindBusinessLogicRule.d.ts +5 -0
  28. package/dist/types/src/classes/BusinessLogicManager/Functie/FunctieTwowayBusinessLogicRule.d.ts +14 -0
  29. package/dist/types/src/classes/BusinessLogicManager/Functiegroep/FunctiegroepSubprojectBusinessLogicRule.d.ts +17 -0
  30. package/dist/types/src/classes/BusinessLogicManager/Inhuurmateriaal/InhuurmateriaalAantalBusinessLogicRule.d.ts +4 -0
  31. package/dist/types/src/classes/BusinessLogicManager/Inhuurmateriaal/InhuurmateriaalAantaltotaalBusinessLogicRule.d.ts +9 -0
  32. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalBulkToSerialBusinessLogicRule.d.ts +17 -0
  33. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalIsCombinationBusinessLogicRule.d.ts +20 -0
  34. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalIsPhysicalCombinationBulkBusinessLogicRule.d.ts +19 -0
  35. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalSerialToBulkBusinessLogicRule.d.ts +16 -0
  36. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalToPhysicalBusinessLogicRule.d.ts +18 -0
  37. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalToVirtualBusinessLogicRule.d.ts +22 -0
  38. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalTypePropertiesBusinessLogicRule.d.ts +19 -0
  39. package/dist/types/src/classes/BusinessLogicManager/Materiaal/MateriaalVerhuurBusinessLogicRule.d.ts +19 -0
  40. package/dist/types/src/classes/BusinessLogicManager/Materiaal/SurfaceArticleSizeBusinessLogicRule.d.ts +23 -0
  41. package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemBusinessLogicRuleBase.d.ts +46 -0
  42. package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemDurationBusinessLogicRule.d.ts +17 -0
  43. package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemMateriaalCatBusinessLogicRule.d.ts +25 -0
  44. package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemSubprojectBusinessLogicRule.d.ts +48 -0
  45. package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemTimeSchemeBusinessLogicRule.d.ts +27 -0
  46. package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemTimeSchemeStartBusinessLogicRule.d.ts +18 -0
  47. package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/LinkedTimeItemTimeValueStartBusinessLogicRule.d.ts +20 -0
  48. package/dist/types/src/classes/BusinessLogicManager/MateriaalCatFunctieFunctiegroep/TimeColumnUtil.d.ts +132 -0
  49. package/dist/types/src/classes/BusinessLogicManager/OfferteContract/OfferteContractDatumBusinessLogicRule.d.ts +21 -0
  50. package/dist/types/src/classes/BusinessLogicManager/PlanningPersoneelTransport/PlanningPersoneelTransportBusinessLogicRule.d.ts +24 -0
  51. package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalAantalBusinessLogicRule.d.ts +4 -0
  52. package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalAantaltotaalBusinessLogicRule.d.ts +9 -0
  53. package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalOptieBusinessLogicRule.d.ts +26 -0
  54. package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalParentBusinessLogicRule.d.ts +17 -0
  55. package/dist/types/src/classes/BusinessLogicManager/Planningmateriaal/PlanningmateriaalStaysAtLocationBusinessLogicRule.d.ts +32 -0
  56. package/dist/types/src/classes/BusinessLogicManager/Project/ProjectClientChangedBusinessLogicRule.d.ts +31 -0
  57. package/dist/types/src/classes/BusinessLogicManager/Project/ProjectContactProjectNoteBusinessLogicRule.d.ts +25 -0
  58. package/dist/types/src/classes/BusinessLogicManager/Project/ProjectOneSubLocationAlignBusinessRule.d.ts +26 -0
  59. package/dist/types/src/classes/BusinessLogicManager/ProjectSubproject/ProjectSubprojectDefaultTimeBusinessLogicRule.d.ts +26 -0
  60. package/dist/types/src/classes/BusinessLogicManager/PurchaseOrder/PurchaseOrderApprovalStatusBusinessLogicRule.d.ts +19 -0
  61. package/dist/types/src/classes/BusinessLogicManager/PurchaseOrder/PurchaseOrderOwnerBusinessLogicRule.d.ts +16 -0
  62. package/dist/types/src/classes/BusinessLogicManager/Rate/RateUpdatedBusinessLogicRule.d.ts +14 -0
  63. package/dist/types/src/classes/BusinessLogicManager/RecurrentItem/RecurrentItemRecureindBusinessLogicRule.d.ts +28 -0
  64. package/dist/types/src/classes/BusinessLogicManager/Reparatie/ReparatieExemplaarAantalBusinessLogicRule.d.ts +14 -0
  65. package/dist/types/src/classes/BusinessLogicManager/Reparatie/ReparatieLostItemExemplaarLocationBusinessLogicRule.d.ts +21 -0
  66. package/dist/types/src/classes/BusinessLogicManager/Rol/RolEditOwnDataBusinessLogicRule.d.ts +20 -0
  67. package/dist/types/src/classes/BusinessLogicManager/Rol/RolFileAccessBusinessLogicRule.d.ts +19 -0
  68. package/dist/types/src/classes/BusinessLogicManager/Rol/RolPersoneelsplannerToegangBusinessLogicRule.d.ts +20 -0
  69. package/dist/types/src/classes/BusinessLogicManager/Rol/RolProjectenBewerkenBusinessLogicRule.d.ts +20 -0
  70. package/dist/types/src/classes/BusinessLogicManager/Rol/RolProjectenToegangBusinessLogicRule.d.ts +21 -0
  71. package/dist/types/src/classes/BusinessLogicManager/Rol/RolPurchaseOrderAttachPlanningBusinessLogicRule.d.ts +19 -0
  72. package/dist/types/src/classes/BusinessLogicManager/Rol/RolVisibilityFinancialsBusinessLogicRule.d.ts +35 -0
  73. package/dist/types/src/classes/BusinessLogicManager/Rol/RolWarehosueTrackingLogAccessBusinessLogicRule.d.ts +20 -0
  74. package/dist/types/src/classes/BusinessLogicManager/Setinhoud/SetinhoudCreateFixedBusinessLogicRule.d.ts +21 -0
  75. package/dist/types/src/classes/BusinessLogicManager/Setinhoud/SetinhoudUpdateFixedBusinessLogicRule.d.ts +26 -0
  76. package/dist/types/src/classes/BusinessLogicManager/Subproject/SubprojectInPlanningBusinessLogicRule.d.ts +14 -0
  77. package/dist/types/src/classes/BusinessLogicManager/Subproject/SubprojectOneSubLocationAlignBusinessRule.d.ts +27 -0
  78. package/dist/types/src/classes/BusinessLogicManager/Subproject/SubprojectOneSubNameAlignBusinessRule.d.ts +22 -0
  79. package/dist/types/src/classes/BusinessLogicManager/Tijd/TijdNameChangedBusinessLogicRule.d.ts +21 -0
  80. package/dist/types/src/classes/BusinessLogicManager/Tijd/TijdSubprojectChangedBusinessLogicRule.d.ts +17 -0
  81. package/dist/types/src/classes/BusinessLogicManager/Uren/HoursTypeBusinessLogicRuleBase.d.ts +10 -0
  82. package/dist/types/src/classes/BusinessLogicManager/Uren/UrenCalculatedDurationBusinessLogicRule.d.ts +13 -0
  83. package/dist/types/src/classes/BusinessLogicManager/Uren/UrenCanHaveActivitiesBusinessLogicRule.d.ts +13 -0
  84. package/dist/types/src/classes/BusinessLogicManager/businessLogicRule.decorator.d.ts +13 -0
  85. package/dist/types/src/classes/BusinessLogicManager/registeredBusinessLogicRules.d.ts +66 -0
  86. package/dist/types/src/classes/ChangesCompilation.d.ts +26 -0
  87. package/dist/types/src/classes/ChangesDelta.d.ts +81 -0
  88. package/dist/types/src/classes/ChangesDeltaBase.d.ts +85 -0
  89. package/dist/types/src/classes/ChangesProcessor.d.ts +35 -0
  90. package/dist/types/src/classes/ChildChangesDelta.d.ts +38 -0
  91. package/dist/types/src/classes/ColumnCache.d.ts +22 -0
  92. package/dist/types/src/classes/ColumnExpansion.d.ts +18 -0
  93. package/dist/types/src/classes/ColumnHandler.d.ts +16 -0
  94. package/dist/types/src/classes/ColumnInfo.d.ts +16 -0
  95. package/dist/types/src/classes/ColumnSet.d.ts +79 -0
  96. package/dist/types/src/classes/ColumnUtil.d.ts +97 -0
  97. package/dist/types/src/classes/ConversionMapService.d.ts +23 -0
  98. package/dist/types/src/classes/CreateRequest.d.ts +16 -0
  99. package/dist/types/src/classes/CreatedChangesDelta.d.ts +22 -0
  100. package/dist/types/src/classes/ItemCache.d.ts +26 -0
  101. package/dist/types/src/classes/ItemCreateService.d.ts +14 -0
  102. package/dist/types/src/classes/ItemEntryService.d.ts +29 -0
  103. package/dist/types/src/classes/KeyService.d.ts +10 -0
  104. package/dist/types/src/classes/LockService.d.ts +28 -0
  105. package/dist/types/src/classes/ModuleChangesCompilation.d.ts +20 -0
  106. package/dist/types/src/classes/ParentChangesDelta.d.ts +42 -0
  107. package/dist/types/src/classes/QueryColumnExtractor.d.ts +16 -0
  108. package/dist/types/src/classes/QueryContainsLocalIdParser.d.ts +14 -0
  109. package/dist/types/src/classes/QueryParser.d.ts +18 -0
  110. package/dist/types/src/classes/QueryParserBase.d.ts +32 -0
  111. package/dist/types/src/classes/QueryParserIdUpdater.d.ts +16 -0
  112. package/dist/types/src/classes/QueryService.d.ts +10 -0
  113. package/dist/types/src/classes/RequestBuffer/RequestBuffer.d.ts +13 -0
  114. package/dist/types/src/classes/RequestBuffer/RequestBufferBase.d.ts +37 -0
  115. package/dist/types/src/classes/RequestBuffer/RequestBufferManager.d.ts +24 -0
  116. package/dist/types/src/classes/RequestBuffer/SingleQueryRequestBuffer.d.ts +18 -0
  117. package/dist/types/src/classes/RequestColumnExpansion.d.ts +11 -0
  118. package/dist/types/src/classes/RequestColumnsOperationsCache.d.ts +45 -0
  119. package/dist/types/src/classes/SocketMessageHandler.d.ts +28 -0
  120. package/dist/types/src/classes/TemplateCache.d.ts +61 -0
  121. package/dist/types/src/classes/Util.d.ts +36 -0
  122. package/dist/types/src/classes/cache/AbstractCache.d.ts +86 -0
  123. package/dist/types/src/classes/cache/CachedQueryHandlerBase.d.ts +145 -0
  124. package/dist/types/src/classes/cache/ItemHandlerBase.d.ts +97 -0
  125. package/dist/types/src/classes/cache/ItemMatcherBase.d.ts +90 -0
  126. package/dist/types/src/classes/cache/server/ServerCache.d.ts +83 -0
  127. package/dist/types/src/classes/cache/server/ServerCachedQueryHandler.d.ts +29 -0
  128. package/dist/types/src/classes/cache/server/ServerItemHandler.d.ts +35 -0
  129. package/dist/types/src/classes/cache/transaction/TransactionCache.d.ts +342 -0
  130. package/dist/types/src/classes/cache/transaction/TransactionCachedQueryHandler.d.ts +111 -0
  131. package/dist/types/src/classes/cache/transaction/TransactionEventHandler.d.ts +17 -0
  132. package/dist/types/src/classes/cache/transaction/TransactionItemHandler.d.ts +121 -0
  133. package/dist/types/src/classes/cache/transaction/TransactionValidator.d.ts +25 -0
  134. package/dist/types/src/classes/cache/transaction/TransactionValidatorBase.d.ts +19 -0
  135. package/dist/types/src/classes/cache/transaction/TransactionValidatorWithDependencies.d.ts +15 -0
  136. package/dist/types/src/classes/changes/CollectionItemChangesListenerContext.d.ts +22 -0
  137. package/dist/types/src/classes/changes/ItemChangesListenerContext.d.ts +7 -0
  138. package/dist/types/src/classes/changes/ItemChangesListenerContextBase.d.ts +44 -0
  139. package/dist/types/src/classes/matcher/CompatorQueryNode.d.ts +24 -0
  140. package/dist/types/src/classes/matcher/CustomQueryNode.d.ts +8 -0
  141. package/dist/types/src/classes/matcher/GraphQueryParser.d.ts +34 -0
  142. package/dist/types/src/classes/matcher/IsComparatorQueryNode.d.ts +13 -0
  143. package/dist/types/src/classes/matcher/LinkedToQueryNode.d.ts +9 -0
  144. package/dist/types/src/classes/matcher/NonMatchableQueryNode.d.ts +9 -0
  145. package/dist/types/src/classes/matcher/NotIsComparatorQueryNode.d.ts +14 -0
  146. package/dist/types/src/classes/matcher/QueryNode.d.ts +49 -0
  147. package/dist/types/src/classes/matcher/RootQueryNode.d.ts +14 -0
  148. package/dist/types/src/classes/matcher/SearchQueryNode.d.ts +8 -0
  149. package/dist/types/src/classes/matcher/SubQueryNode.d.ts +8 -0
  150. package/dist/types/src/classes/matcher/ValueTransformers.d.ts +41 -0
  151. package/dist/types/src/classes/matcher/ValuelessEdgeQueryNode.d.ts +11 -0
  152. package/dist/types/src/classes/matcher/greater-smaller-than-comparator-query.node.d.ts +25 -0
  153. package/dist/types/src/constants.d.ts +2 -0
  154. package/dist/types/src/core.d.ts +63 -0
  155. package/dist/types/src/exceptions/CriticalBusinessLogicRuleException.d.ts +4 -0
  156. package/dist/types/src/exceptions/ItemAlreadyExistsException.d.ts +4 -0
  157. package/dist/types/src/exceptions/ItemLockedException.d.ts +2 -0
  158. package/dist/types/src/exceptions/ItemNotFoundException.d.ts +5 -0
  159. package/dist/types/src/exceptions/MissingColumnException.d.ts +6 -0
  160. package/dist/types/src/exceptions/SavingInProgressException.d.ts +2 -0
  161. package/dist/types/src/exceptions/TransactionPendingException.d.ts +2 -0
  162. package/dist/types/src/factories/ApiResponseProcessorFactory.d.ts +5 -0
  163. package/dist/types/src/factories/ChangesCompilationFactory.d.ts +5 -0
  164. package/dist/types/src/factories/ChangesDeltaFactory.d.ts +13 -0
  165. package/dist/types/src/factories/CollectionResourceFactory.d.ts +20 -0
  166. package/dist/types/src/factories/ColumnExpansionFactory.d.ts +7 -0
  167. package/dist/types/src/factories/ColumnInfoFactory.d.ts +7 -0
  168. package/dist/types/src/factories/ColumnSetFactory.d.ts +15 -0
  169. package/dist/types/src/factories/GraphQueryParserFactory.d.ts +10 -0
  170. package/dist/types/src/factories/ItemCacheFactory.d.ts +7 -0
  171. package/dist/types/src/factories/ItemResourceFactory.d.ts +7 -0
  172. package/dist/types/src/factories/ModuleChangesCompilationFactory.d.ts +6 -0
  173. package/dist/types/src/factories/RequestColumnExpansionFactory.d.ts +4 -0
  174. package/dist/types/src/factories/RequestColumnsOperationsCacheFactory.d.ts +7 -0
  175. package/dist/types/src/factories/TransactionCacheFactory.d.ts +12 -0
  176. package/dist/types/src/index.d.ts +11 -0
  177. package/dist/types/src/interfaces/AbstractCacheDependencyInterface.d.ts +46 -0
  178. package/dist/types/src/interfaces/ApiRequestServiceInterface.d.ts +14 -0
  179. package/dist/types/src/interfaces/ErrorHandlerInterface.d.ts +6 -0
  180. package/dist/types/src/interfaces/LinkTreeServiceInterface.d.ts +6 -0
  181. package/dist/types/src/interfaces/ServerCacheDependencyInterface.d.ts +6 -0
  182. package/dist/types/src/interfaces/SocketMessageInterface.d.ts +3 -0
  183. package/dist/types/src/interfaces/TransactionCollectionHandlerDependencyInterface.d.ts +15 -0
  184. package/dist/types/src/interfaces/TransactionItemHandlerDependencyInterface.d.ts +16 -0
  185. package/dist/types/src/internal.d.ts +110 -0
  186. package/dist/types/src/models/CachedQueryItem.d.ts +33 -0
  187. package/dist/types/src/models/CollectionEntry.d.ts +16 -0
  188. package/dist/types/src/models/CollectionOptions.d.ts +111 -0
  189. package/dist/types/src/models/CollectionResource.d.ts +175 -0
  190. package/dist/types/src/models/ItemEntry.d.ts +23 -0
  191. package/dist/types/src/models/ItemOptions.d.ts +25 -0
  192. package/dist/types/src/models/ItemResource.d.ts +135 -0
  193. package/dist/types/src/models/LimitedCollectionResource.d.ts +26 -0
  194. package/dist/types/src/models/OrderedCollectionResource.d.ts +19 -0
  195. package/dist/types/src/models/Template.d.ts +17 -0
  196. package/dist/types/src/services/rm-holidays.service.d.ts +31 -0
  197. package/dist/types/src/types/AggregatedChangesListener.d.ts +99 -0
  198. package/dist/types/src/types/ApiQuery.d.ts +95 -0
  199. package/dist/types/src/types/ItemTypesCollection.d.ts +416 -0
  200. package/package.json +56 -0
  201. package/readme.md +42 -0
@@ -0,0 +1,21 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
5
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
6
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
7
+ type ConditionResult = ItemId[];
8
+ type Dependency = ItemResource<'Rol', [
9
+ 'uren_kosten',
10
+ 'visibility_financials'
11
+ ]>[];
12
+ /**
13
+ * @description
14
+ * If you have access to projects you should be able to make costs for registered hours
15
+ */
16
+ export declare class RolProjectenToegangBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
17
+ condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
18
+ dependency(transaction: TransactionCache, rolIds: ConditionResult): Promise<Dependency>;
19
+ apply(context: BusinessLogicRuleApplyContext, rolResources: Dependency): void;
20
+ }
21
+ export {};
@@ -0,0 +1,19 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
5
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
6
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
7
+ type ConditionResult = ItemId[];
8
+ declare const roleColumns: readonly ["purchaseorders_edit"];
9
+ type Dependency = ItemResource<'Rol', typeof roleColumns>[];
10
+ /**
11
+ * @description
12
+ * You can only have the right to attach crew plannings to purchase orders if you can edit all purchase orders
13
+ */
14
+ export declare class RolPurchaseOrderAttachPlanningBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
15
+ condition({ previousChangesDelta, }: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
16
+ dependency(transaction: TransactionCache, rolIds: ConditionResult): Promise<Dependency>;
17
+ apply(context: BusinessLogicRuleApplyContext, rolResources: Dependency): void;
18
+ }
19
+ export {};
@@ -0,0 +1,35 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
5
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
6
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
7
+ type ConditionResult = ItemId[];
8
+ type Dependency = ItemResource<'Rol', [
9
+ 'visibility_financials',
10
+ 'facturen_toegang',
11
+ 'projecten_facturen_maken',
12
+ 'projecten_offertes_maken',
13
+ 'projecten_toegang'
14
+ ]>[];
15
+ /**
16
+ * @description
17
+ * If you're not allowed to see financials, then you should not have the permission to
18
+ * 1. access the invoices module
19
+ * 2. create invoices, quotes and contracts in projects
20
+ * 3. see rates of crew members in activities in the time registration.
21
+ */
22
+ export declare class RolVisibilityFinancialsBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
23
+ condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
24
+ dependency(transaction: TransactionCache, rolIds: ConditionResult): Promise<Dependency>;
25
+ /**
26
+ * If the financial visibility is turned off:
27
+ *
28
+ * all financial related permissions should be off as well
29
+ * with the exception of "uren_kosten", which can be set independently from financial visibility.
30
+ *
31
+ *
32
+ */
33
+ apply(context: BusinessLogicRuleApplyContext, rolResources: Dependency): void;
34
+ }
35
+ export {};
@@ -0,0 +1,20 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
5
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
6
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
7
+ type ConditionResult = ItemId[];
8
+ type Dependency = ItemResource<'Rol', [
9
+ 'magazijn_toegang'
10
+ ]>[];
11
+ /**
12
+ * @description
13
+ * If you can enter access the Warehouse Tracking Log, you can also access Warehouse module
14
+ */
15
+ export declare class RolWarehouseTrackingLogAccessBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
16
+ condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
17
+ dependency(transaction: TransactionCache, roldIds: ConditionResult): Promise<Dependency>;
18
+ apply(context: BusinessLogicRuleApplyContext, rolResources: Dependency): void;
19
+ }
20
+ export {};
@@ -0,0 +1,21 @@
1
+ import { ItemResource } from '../../../models/ItemResource';
2
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
3
+ import { ChangesDeltaItemCreateDelta } from '../../CreatedChangesDelta';
4
+ import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
5
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
6
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
7
+ declare const materiaalColumns: readonly ["id", "type"];
8
+ type ConditionResult = ChangesDeltaItemCreateDelta<'Setinhoud'>[];
9
+ type Dependency = Record<string, ItemResource<'Materiaal', typeof materiaalColumns>>;
10
+ /**
11
+ * Legacy users won't have the `FUNCTIONALITY_FLEXIBLE_COMBINATION_IN_PLANNING` flag, meaning the `is_fixed` column from `Setinhoud` column isn't editable
12
+ * With this business rule we enforce the correct (default) value based on the equipment properties (Backend enforces this as well)
13
+ *
14
+ * For users with the flag this just sets a default value in the same way, but `is_fixed` is editable after it has been created
15
+ */
16
+ export declare class SetinhoudCreateFixedBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
17
+ condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
18
+ dependency(transaction: TransactionCache, conditionResult: ConditionResult): Promise<Dependency>;
19
+ apply(context: BusinessLogicRuleApplyContext, dependencyResult: Dependency, conditionResult: ConditionResult): void;
20
+ }
21
+ export {};
@@ -0,0 +1,26 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
5
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
6
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
7
+ declare const setinhoudColumns: readonly ["is_fixed", {
8
+ readonly package: readonly ["type"];
9
+ }];
10
+ type ConditionResult = {
11
+ Materiaal: ItemId<'Materiaal'>[];
12
+ Setinhoud: ItemId<'Setinhoud'>[];
13
+ };
14
+ type Dependency = ItemResource<'Setinhoud', typeof setinhoudColumns>[];
15
+ /**
16
+ * For legacy users we have to keep track of the correct value based on the equipment properties,
17
+ * similarly to when creating a new `Setinhoud`, see {@link SetinhoudCreateFixedBusinessLogicRule}
18
+ *
19
+ * For normal users the `is_fixed` column is editable, so we don't have to update it
20
+ */
21
+ export declare class SetinhoudUpdateFixedBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
22
+ condition({ previousChangesDelta, }: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
23
+ dependency(transaction: TransactionCache, conditionResult: ConditionResult): Promise<Dependency>;
24
+ apply(context: BusinessLogicRuleApplyContext, setinhoudResources: Dependency): void;
25
+ }
26
+ export {};
@@ -0,0 +1,14 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { BLR_SKIP_RULE, BusinessLogicRule, BusinessLogicRuleApplyContext, BusinessLogicRuleConditionContext, ItemResource, TransactionCache } from '../../../internal';
3
+ type Dependency = Map<ItemId<'Subproject'>, ItemResource<'Functie', ['subproject', 'inplanning']>[]>;
4
+ type ConditionResult = Map<ItemId<'Subproject'>, boolean>;
5
+ /**
6
+ * Whenever the 'inplanning' field of a subproject changes, set the 'inplanning' field of all functions in the
7
+ * subproject to the same value.
8
+ */
9
+ export declare class SubprojectInPlanningBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
10
+ condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
11
+ dependency(transaction: TransactionCache, subprojectInPlanningMap: ConditionResult): Promise<Dependency>;
12
+ apply(context: BusinessLogicRuleApplyContext, subprojectFunctionResourceMap: Dependency, subprojectInPlanningMap: ConditionResult): void;
13
+ }
14
+ export {};
@@ -0,0 +1,27 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
5
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
6
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
7
+ type ConditionResult = ItemId[];
8
+ type Dependency = {
9
+ [projectId: number]: {
10
+ Subproject: ItemResource<'Subproject', ['id', 'project', 'locatie', 'locatie_persoon']>;
11
+ Project: ItemResource<'Project', ['id', 'locatie']>;
12
+ amountOfSubprojects: number;
13
+ };
14
+ };
15
+ /**
16
+ * @description
17
+ * Whenever the location of a Subproject changes in a one-sub (Project with no subprojects)
18
+ * we ensure the `locatie` & 'locatie_persoon` field gets applied on the Project too
19
+ *
20
+ * Has similar opposite Business Rule for Projects {@link ProjectOneSubLocationAlignBusinessLogicRule}
21
+ */
22
+ export declare class SubprojectOneSubLocationAlignBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
23
+ condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
24
+ dependency(transaction: TransactionCache, obj: ConditionResult): Promise<Dependency>;
25
+ apply(context: BusinessLogicRuleApplyContext, obj: Dependency): void;
26
+ }
27
+ export {};
@@ -0,0 +1,22 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
5
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
6
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
7
+ type ConditionResult = ItemId[];
8
+ type Dependency = {
9
+ projectResource: ItemResource<'Project', ['id', 'naam']>;
10
+ subprojectResources: ItemResource<'Subproject', ['id', 'project', 'naam']>[];
11
+ }[];
12
+ /**
13
+ * @description
14
+ * Whenever the name of a subproject changes in a one-sub (Project with no subprojects) we ensure the name field gets
15
+ * applied to the project too.
16
+ */
17
+ export declare class SubprojectOneSubNameAlignBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
18
+ condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
19
+ dependency(transaction: TransactionCache, projectIds: ConditionResult): Promise<Dependency>;
20
+ apply(context: BusinessLogicRuleApplyContext, projectTuples: Dependency): void;
21
+ }
22
+ export {};
@@ -0,0 +1,21 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
5
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
6
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
7
+ type ConditionResult = ItemId[];
8
+ type Dependency = {
9
+ tijdResource: ItemResource<'Tijd', ['naam', 'id']>;
10
+ functiegroepResource: ItemResource<'Functiegroep', ['naam']>;
11
+ }[];
12
+ /**
13
+ * @description
14
+ * If the 'naam' of the Tijd item changes, update function groups with the same name connected to this Tijd item
15
+ */
16
+ export declare class TijdNameChangedBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
17
+ condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
18
+ dependency(transaction: TransactionCache, tijdIds: ConditionResult): Promise<Dependency>;
19
+ apply(context: BusinessLogicRuleApplyContext, tijdFunctiegroepTuples: Dependency): void;
20
+ }
21
+ export {};
@@ -0,0 +1,17 @@
1
+ import { BLR_SKIP_RULE, BusinessLogicConditionResult, BusinessLogicRule, BusinessLogicRuleApplyContext, BusinessLogicRuleConditionContext, CollectionResource, ItemResource, TransactionCache } from '../../../internal';
2
+ declare const projectDefaultTimeColumns: readonly ["id", "gebruiksperiode", "planperiode"];
3
+ type ConditionResult = BusinessLogicConditionResult<'Tijd', 'subproject'>[];
4
+ type Dependency = ItemResource<'Project', typeof projectDefaultTimeColumns, {
5
+ Subproject: CollectionResource<'Subproject', typeof projectDefaultTimeColumns>;
6
+ }>;
7
+ /**
8
+ * When moving a time to a subproject, if the default times of the main project and any subprojects
9
+ * other than the destination subproject refer to the time, set them to `null`. We need to check all subprojects
10
+ * because the time might be originating from the main project.
11
+ */
12
+ export declare class TijdSubprojectChangedBusinessLogicRule extends BusinessLogicRule<ConditionResult, Dependency> {
13
+ condition(context: BusinessLogicRuleConditionContext): ConditionResult | typeof BLR_SKIP_RULE;
14
+ dependency(transaction: TransactionCache, timeItemChanges: ConditionResult): Promise<Dependency>;
15
+ apply(context: BusinessLogicRuleApplyContext, projectResource: Dependency, timeItemChanges: ConditionResult): void;
16
+ }
17
+ export {};
@@ -0,0 +1,10 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { ItemTypeColumnId } from '../../../types/ItemTypesCollection';
3
+ import { BLR_SKIP_RULE, BusinessLogicRule } from '../BusinessLogicRule';
4
+ import { BusinessLogicRuleConditionContext } from '../BusinessLogicRuleConditionContext';
5
+ type ConditionResult = ItemId<'Uren'>[];
6
+ export declare abstract class HoursTypeBusinessLogicRuleBase<DependencyType> extends BusinessLogicRule<ConditionResult, DependencyType> {
7
+ protected abstract conditionColumnId: ItemTypeColumnId<'HoursType'>;
8
+ condition(context: BusinessLogicRuleConditionContext): Promise<ConditionResult | typeof BLR_SKIP_RULE>;
9
+ }
10
+ export {};
@@ -0,0 +1,13 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
5
+ import { HoursTypeBusinessLogicRuleBase } from './HoursTypeBusinessLogicRuleBase';
6
+ declare const hoursColumns: readonly ["pauze", "reistijd"];
7
+ type Dependency = ItemResource<'Uren', typeof hoursColumns>[];
8
+ export declare class UrenCalculatedDurationBusinessLogicRule extends HoursTypeBusinessLogicRuleBase<Dependency> {
9
+ conditionColumnId: "has_calculated_duration";
10
+ dependency(transaction: TransactionCache, conditionResult: ItemId<'Uren'>[]): Promise<Dependency>;
11
+ apply(context: BusinessLogicRuleApplyContext, hoursResources: Dependency): void;
12
+ }
13
+ export {};
@@ -0,0 +1,13 @@
1
+ import { ItemId } from '@rentman/backend-types';
2
+ import { ItemResource } from '../../../models/ItemResource';
3
+ import { TransactionCache } from '../../cache/transaction/TransactionCache';
4
+ import { BusinessLogicRuleApplyContext } from '../BusinessLogicRuleApplyContext';
5
+ import { HoursTypeBusinessLogicRuleBase } from './HoursTypeBusinessLogicRuleBase';
6
+ declare const functionHourColumns: readonly ["uren"];
7
+ type Dependency = ItemResource<'Functieuur', typeof functionHourColumns>[];
8
+ export declare class UrenCanHaveActivitiesBusinessLogicRule extends HoursTypeBusinessLogicRuleBase<Dependency> {
9
+ conditionColumnId: "can_have_activities";
10
+ dependency(transaction: TransactionCache, conditionResult: ItemId<'Uren'>[]): Promise<Dependency>;
11
+ apply(context: BusinessLogicRuleApplyContext, functieuurResources: Dependency): void;
12
+ }
13
+ export {};
@@ -0,0 +1,13 @@
1
+ import { ApiModuleFunctionResponse } from '@rentman/backend-types';
2
+ import { HasFlagFn } from '../../types/ItemTypesCollection';
3
+ import { BusinessLogicRule } from './BusinessLogicRule';
4
+ export type BusinessLogicRuleConstructor<BusinessLogicRuleType extends BusinessLogicRule<any, any> = BusinessLogicRule<any, any>> = new (locals: ApiModuleFunctionResponse<'locals', 'getLocals'>, hasFlagFn: HasFlagFn) => BusinessLogicRuleType;
5
+ export type BusinessLogicRuleConstructorName = BusinessLogicRuleConstructor & {
6
+ __name: string;
7
+ };
8
+ /**
9
+ * Decorator for business logic rules. Currently defines the name. We could add additional metadata in the future.
10
+ *
11
+ * All business logic rules should be registered in `registeredBusinessLogicRules.ts`.
12
+ */
13
+ export declare function businessLogicRule(name: string): (constructor: BusinessLogicRuleConstructor) => void;
@@ -0,0 +1,66 @@
1
+ import { AfspraakRecureindBusinessLogicRule } from './Afspraak/AfspraakRecureindBusinessLogicRule';
2
+ import { BeschikbaarheidRecureindBusinessLogicRule } from './Beschikbaarheid/BeschikbaarheidRecureindBusinessLogicRule';
3
+ import { ContactAddressBusinessLogicRule } from './Contact/ContactAddressBusinessLogicRule';
4
+ import { CustomFieldLinkedItemTypeBusinessLogicRule } from './Customfield/CustomFieldLinkedItemTypeBusinessLogicRule';
5
+ import { CustomFieldTypeBusinessLogicRule } from './Customfield/CustomFieldTypeBusinessLogicRule';
6
+ import { DefaultContactPersonUpdateBusinessLogicRule } from './DefaultContactPersonUpdateBusinessLogicRule';
7
+ import { DocumentTemplateBusinessLogicRule } from './Documents/DocumentTemplateBusinessLogicRule';
8
+ import { ExemplaarAanschafdatumBusinessLogicRule } from './Exemplaar/ExemplaarAanschafdatumBusinessLogicRule';
9
+ import { ExemplaarBarcodeDeleteBusinessLogicRule } from './Exemplaar/ExemplaarBarcodeDeleteBusinessLogicRule';
10
+ import { FactuurBetalingsconditieBusinessLogicRule } from './Factuur/FactuurBetalingsconditieBusinessLogicRule';
11
+ import { FactuurDatumBusinessLogicRule } from './Factuur/FactuurDatumBusinessLogicRule';
12
+ import { FactuurNumberseriesBusinessLogicRule } from './Factuur/FactuurNumberseriesBusinessLogicRule';
13
+ import { FilesNameExtensionBusinessLogicRule } from './Files/FilesNameExtensionBusinessLogicRule';
14
+ import { FunctieNaaminternBusinessLogicRule } from './Functie/FunctieNaaminternBusinessLogicRule';
15
+ import { FunctieRecureindBusinessLogicRule } from './Functie/FunctieRecureindBusinessLogicRule';
16
+ import { FunctieTwowayBusinessLogicRule } from './Functie/FunctieTwowayBusinessLogicRule';
17
+ import { FunctiegroepSubprojectBusinessLogicRule } from './Functiegroep/FunctiegroepSubprojectBusinessLogicRule';
18
+ import { InhuurmateriaalAantalBusinessLogicRule } from './Inhuurmateriaal/InhuurmateriaalAantalBusinessLogicRule';
19
+ import { InhuurmateriaalAantaltotaalBusinessLogicRule } from './Inhuurmateriaal/InhuurmateriaalAantaltotaalBusinessLogicRule';
20
+ import { MateriaalBulkToSerialBusinessLogicRule } from './Materiaal/MateriaalBulkToSerialBusinessLogicRule';
21
+ import { MateriaalIsCombinationBusinessLogicRule } from './Materiaal/MateriaalIsCombinationBusinessLogicRule';
22
+ import { MateriaalIsPhysicalCombinationBulkBusinessLogicRule } from './Materiaal/MateriaalIsPhysicalCombinationBulkBusinessLogicRule';
23
+ import { MateriaalSerialToBulkBusinessLogicRule } from './Materiaal/MateriaalSerialToBulkBusinessLogicRule';
24
+ import { MateriaalToPhysicalBusinessLogicRule } from './Materiaal/MateriaalToPhysicalBusinessLogicRule';
25
+ import { MateriaalToVirtualBusinessLogicRule } from './Materiaal/MateriaalToVirtualBusinessLogicRule';
26
+ import { MateriaalTypePropertiesBusinessLogicRule } from './Materiaal/MateriaalTypePropertiesBusinessLogicRule';
27
+ import { MateriaalVerhuurBusinessLogicRule } from './Materiaal/MateriaalVerhuurBusinessLogicRule';
28
+ import { SurfaceArticleSizeBusinessLogicRule } from './Materiaal/SurfaceArticleSizeBusinessLogicRule';
29
+ import { LinkedTimeItemDurationBusinessLogicRule } from './MateriaalCatFunctieFunctiegroep/LinkedTimeItemDurationBusinessLogicRule';
30
+ import { LinkedTimeItemMateriaalCatBusinessLogicRule } from './MateriaalCatFunctieFunctiegroep/LinkedTimeItemMateriaalCatBusinessLogicRule';
31
+ import { LinkedTimeItemSubprojectBusinessLogicRule } from './MateriaalCatFunctieFunctiegroep/LinkedTimeItemSubprojectBusinessLogicRule';
32
+ import { LinkedTimeItemTimeSchemeBusinessLogicRule } from './MateriaalCatFunctieFunctiegroep/LinkedTimeItemTimeSchemeBusinessLogicRule';
33
+ import { LinkedTimeItemTimeSchemeStartBusinessLogicRule } from './MateriaalCatFunctieFunctiegroep/LinkedTimeItemTimeSchemeStartBusinessLogicRule';
34
+ import { LinkedTimeItemTimeValueStartBusinessLogicRule } from './MateriaalCatFunctieFunctiegroep/LinkedTimeItemTimeValueStartBusinessLogicRule';
35
+ import { OfferteContractDatumBusinessLogicRule } from './OfferteContract/OfferteContractDatumBusinessLogicRule';
36
+ import { PlanningmateriaalAantalBusinessLogicRule } from './Planningmateriaal/PlanningmateriaalAantalBusinessLogicRule';
37
+ import { PlanningmateriaalAantaltotaalBusinessLogicRule } from './Planningmateriaal/PlanningmateriaalAantaltotaalBusinessLogicRule';
38
+ import { PlanningmateriaalOptieBusinessLogicRule } from './Planningmateriaal/PlanningmateriaalOptieBusinessLogicRule';
39
+ import { PlanningmateriaalParentBusinessLogicRule } from './Planningmateriaal/PlanningmateriaalParentBusinessLogicRule';
40
+ import { PlanningmateriaalStaysAtLocationBusinessLogicRule } from './Planningmateriaal/PlanningmateriaalStaysAtLocationBusinessLogicRule';
41
+ import { PlanningPersoneelTransportBusinessLogicRule } from './PlanningPersoneelTransport/PlanningPersoneelTransportBusinessLogicRule';
42
+ import { ProjectClientChangedBusinessLogicRule } from './Project/ProjectClientChangedBusinessLogicRule';
43
+ import { ProjectContactProjectNoteBusinessLogicRule } from './Project/ProjectContactProjectNoteBusinessLogicRule';
44
+ import { ProjectOneSubLocationAlignBusinessLogicRule } from './Project/ProjectOneSubLocationAlignBusinessRule';
45
+ import { ProjectSubprojectDefaultTimeBusinessLogicRule } from './ProjectSubproject/ProjectSubprojectDefaultTimeBusinessLogicRule';
46
+ import { PurchaseOrderApprovalStatusBusinessLogicRule } from './PurchaseOrder/PurchaseOrderApprovalStatusBusinessLogicRule';
47
+ import { PurchaseOrderOwnerBusinessLogicRule } from './PurchaseOrder/PurchaseOrderOwnerBusinessLogicRule';
48
+ import { RateUpdatedBusinessLogicRule } from './Rate/RateUpdatedBusinessLogicRule';
49
+ import { ReparatiesExemplaarAantalBusinessLogicRule } from './Reparatie/ReparatieExemplaarAantalBusinessLogicRule';
50
+ import { ReparatieLostItemExemplaarLocationBusinessLogicRule } from './Reparatie/ReparatieLostItemExemplaarLocationBusinessLogicRule';
51
+ import { RolEditOwnDataBusinessLogicRule } from './Rol/RolEditOwnDataBusinessLogicRule';
52
+ import { RolFileAccessBusinessLogicRule } from './Rol/RolFileAccessBusinessLogicRule';
53
+ import { RolPersoneelsplannerToegangBusinessLogicRule } from './Rol/RolPersoneelsplannerToegangBusinessLogicRule';
54
+ import { RolProjectenBewerkenBusinessLogicRule } from './Rol/RolProjectenBewerkenBusinessLogicRule';
55
+ import { RolProjectenToegangBusinessLogicRule } from './Rol/RolProjectenToegangBusinessLogicRule';
56
+ import { RolPurchaseOrderAttachPlanningBusinessLogicRule } from './Rol/RolPurchaseOrderAttachPlanningBusinessLogicRule';
57
+ import { RolVisibilityFinancialsBusinessLogicRule } from './Rol/RolVisibilityFinancialsBusinessLogicRule';
58
+ import { RolWarehouseTrackingLogAccessBusinessLogicRule } from './Rol/RolWarehosueTrackingLogAccessBusinessLogicRule';
59
+ import { SetinhoudCreateFixedBusinessLogicRule } from './Setinhoud/SetinhoudCreateFixedBusinessLogicRule';
60
+ import { SetinhoudUpdateFixedBusinessLogicRule } from './Setinhoud/SetinhoudUpdateFixedBusinessLogicRule';
61
+ import { SubprojectInPlanningBusinessLogicRule } from './Subproject/SubprojectInPlanningBusinessLogicRule';
62
+ import { SubprojectOneSubLocationAlignBusinessLogicRule } from './Subproject/SubprojectOneSubLocationAlignBusinessRule';
63
+ import { SubprojectOneSubNameAlignBusinessLogicRule } from './Subproject/SubprojectOneSubNameAlignBusinessRule';
64
+ import { TijdNameChangedBusinessLogicRule } from './Tijd/TijdNameChangedBusinessLogicRule';
65
+ import { TijdSubprojectChangedBusinessLogicRule } from './Tijd/TijdSubprojectChangedBusinessLogicRule';
66
+ export declare const registeredBusinessLogicRules: readonly [typeof DefaultContactPersonUpdateBusinessLogicRule, typeof ContactAddressBusinessLogicRule, typeof CustomFieldLinkedItemTypeBusinessLogicRule, typeof CustomFieldTypeBusinessLogicRule, typeof DocumentTemplateBusinessLogicRule, typeof ExemplaarAanschafdatumBusinessLogicRule, typeof ExemplaarBarcodeDeleteBusinessLogicRule, typeof FactuurBetalingsconditieBusinessLogicRule, typeof FactuurDatumBusinessLogicRule, typeof FactuurNumberseriesBusinessLogicRule, typeof FilesNameExtensionBusinessLogicRule, typeof FunctieNaaminternBusinessLogicRule, typeof FunctieTwowayBusinessLogicRule, typeof FunctieRecureindBusinessLogicRule, typeof FunctiegroepSubprojectBusinessLogicRule, typeof InhuurmateriaalAantaltotaalBusinessLogicRule, typeof InhuurmateriaalAantalBusinessLogicRule, typeof MateriaalIsCombinationBusinessLogicRule, typeof MateriaalIsPhysicalCombinationBulkBusinessLogicRule, typeof MateriaalToVirtualBusinessLogicRule, typeof MateriaalToPhysicalBusinessLogicRule, typeof MateriaalBulkToSerialBusinessLogicRule, typeof MateriaalSerialToBulkBusinessLogicRule, typeof MateriaalTypePropertiesBusinessLogicRule, typeof MateriaalVerhuurBusinessLogicRule, typeof SurfaceArticleSizeBusinessLogicRule, typeof LinkedTimeItemDurationBusinessLogicRule, typeof LinkedTimeItemTimeSchemeBusinessLogicRule, typeof LinkedTimeItemTimeSchemeStartBusinessLogicRule, typeof LinkedTimeItemTimeValueStartBusinessLogicRule, typeof LinkedTimeItemSubprojectBusinessLogicRule, typeof LinkedTimeItemMateriaalCatBusinessLogicRule, typeof OfferteContractDatumBusinessLogicRule, typeof PlanningmateriaalAantalBusinessLogicRule, typeof PlanningmateriaalAantaltotaalBusinessLogicRule, typeof PlanningmateriaalOptieBusinessLogicRule, typeof PlanningmateriaalParentBusinessLogicRule, typeof PlanningmateriaalStaysAtLocationBusinessLogicRule, typeof PlanningPersoneelTransportBusinessLogicRule, typeof ProjectClientChangedBusinessLogicRule, typeof ProjectContactProjectNoteBusinessLogicRule, typeof ProjectOneSubLocationAlignBusinessLogicRule, typeof ProjectSubprojectDefaultTimeBusinessLogicRule, typeof PurchaseOrderOwnerBusinessLogicRule, typeof PurchaseOrderApprovalStatusBusinessLogicRule, typeof RateUpdatedBusinessLogicRule, typeof ReparatiesExemplaarAantalBusinessLogicRule, typeof ReparatieLostItemExemplaarLocationBusinessLogicRule, typeof RolEditOwnDataBusinessLogicRule, typeof RolFileAccessBusinessLogicRule, typeof RolPersoneelsplannerToegangBusinessLogicRule, typeof RolProjectenBewerkenBusinessLogicRule, typeof RolProjectenToegangBusinessLogicRule, typeof RolVisibilityFinancialsBusinessLogicRule, typeof RolWarehouseTrackingLogAccessBusinessLogicRule, typeof RolPurchaseOrderAttachPlanningBusinessLogicRule, typeof SetinhoudCreateFixedBusinessLogicRule, typeof SetinhoudUpdateFixedBusinessLogicRule, typeof SubprojectOneSubLocationAlignBusinessLogicRule, typeof SubprojectOneSubNameAlignBusinessLogicRule, typeof SubprojectInPlanningBusinessLogicRule, typeof TijdSubprojectChangedBusinessLogicRule, typeof TijdNameChangedBusinessLogicRule, typeof AfspraakRecureindBusinessLogicRule, typeof BeschikbaarheidRecureindBusinessLogicRule];
@@ -0,0 +1,26 @@
1
+ import { ApiItemType } from '@rentman/backend-types';
2
+ import { ChildChangesDeltaItemCreateDelta, ItemEntry, ItemEntryMap, ItemMap, TransactionCache } from '../internal';
3
+ export type CreateRequestCompilationParent = ApiItemType | 'Void';
4
+ export type CreateCompilation = {
5
+ [parentType: string]: {
6
+ [parentId: number]: ItemMap<ChildChangesDeltaItemCreateDelta>;
7
+ };
8
+ };
9
+ export type DeleteCompilation = {
10
+ [itemType: string]: ItemEntry[];
11
+ };
12
+ export type UpdateCompilation = ItemEntryMap;
13
+ export declare class ChangesCompilation {
14
+ private transaction;
15
+ compilation: {
16
+ create: CreateCompilation;
17
+ delete: DeleteCompilation;
18
+ update: UpdateCompilation;
19
+ };
20
+ constructor(transaction: TransactionCache);
21
+ private processDelta;
22
+ private getDefaultParent;
23
+ private addDeleteEntry;
24
+ private addUpdateEntry;
25
+ private addCreateEntry;
26
+ }
@@ -0,0 +1,81 @@
1
+ import { ApiFields, ApiItemType, ItemId } from '@rentman/backend-types';
2
+ import { ChangesDeltaBase, ChangesDeltaBaseItemDeleteDelta, ChangesDeltaBaseItemUpdateDelta, ChangesDeltaItemCreateDelta, ChangesDeltaItemUpdateMode, ColumnExpansion, ColumnSet, CreatedChangesDelta, EntryParentNull, ErrorHandlerInterface, FieldMap, ItemCreateService, ItemEntry, ItemEntryChangesTuple, ItemEntryService, RequestParameters } from '../internal';
3
+ export interface ChangesDeltaItemDeleteDelta<ItemTypeType extends ApiItemType> extends ChangesDeltaBaseItemDeleteDelta<ItemTypeType> {
4
+ isCascaded: boolean;
5
+ }
6
+ export interface ChangesDeltaItemUpdateDelta<ItemTypeType extends ApiItemType> extends ChangesDeltaBaseItemUpdateDelta<ItemTypeType> {
7
+ entry: ItemEntry<ItemTypeType>;
8
+ changes: {
9
+ fields: FieldMap<ItemTypeType>;
10
+ columnExpansions: ColumnExpansion<ItemTypeType>[];
11
+ };
12
+ mode: ChangesDeltaItemUpdateMode;
13
+ }
14
+ /**
15
+ * @description
16
+ * ChangesDelta used to apply changes from outside of the core to a transaction
17
+ *
18
+ * ----------
19
+ *
20
+ * The difference between {@link ChildChangesDelta} and {@link ChangesDelta} is that the ChangesDelta
21
+ * assumes 'created' values have no itemEntries yet.
22
+ *
23
+ * Use this when calling {@link TransactionCache.applyChangesDelta applyChangesDelta}
24
+ */
25
+ export declare class ChangesDelta extends ChangesDeltaBase<ChangesDeltaItemDeleteDelta<any>> {
26
+ logMissingColumnErrors: boolean;
27
+ private errorHandler;
28
+ private itemCreateService;
29
+ updated: {
30
+ [itemEntryId: number]: ChangesDeltaItemUpdateDelta<any>;
31
+ };
32
+ created: CreatedChangesDelta;
33
+ /**
34
+ * Only contains remote items, when rolling back local items the whole entries are deleted.
35
+ */
36
+ restored: {
37
+ [itemEntryId: number]: ItemEntryChangesTuple<any>;
38
+ };
39
+ constructor(logMissingColumnErrors: boolean, queryItemTypes: Iterable<ApiItemType> | undefined, errorHandler: ErrorHandlerInterface, itemCreateService: ItemCreateService, itemEntryService: ItemEntryService);
40
+ getCreatedTuplesIterator<ItemTypeType extends ApiItemType>(itemType: ItemTypeType): IterableIterator<ChangesDeltaItemCreateDelta<ItemTypeType>>;
41
+ getUpdatedTuplesIterator<ItemTypes extends ApiItemType[]>(...itemTypes: ItemTypes): Generator<ChangesDeltaItemUpdateDelta<ItemTypes extends [] ? any : ItemTypes[number]>>;
42
+ merge(otherChangesDelta: ChangesDelta): ChangesDelta;
43
+ /**
44
+ * @description
45
+ * Fetches a template for the passed itemType and processes the passed values and sets the item to be created when the delta is applied
46
+ *
47
+ * @remark
48
+ * - If the values don't contain an `id` a new one will be generated
49
+ * - If you want to set a parent set the proper field, you can't pass it as a separate object
50
+ */
51
+ setItemCreated<ItemTypeType extends ApiItemType, Fields extends Partial<FieldMap<ItemTypeType>>>(itemType: ItemTypeType, values: Fields, templateOptions?: Partial<RequestParameters<ItemTypeType>>): Promise<this>;
52
+ setItemCreatedByTuple<ItemTypeType extends ApiItemType>(itemCreateTuple: ChangesDeltaItemCreateDelta<ItemTypeType>, updatedFields: Partial<FieldMap<ItemTypeType>>): ChangesDelta;
53
+ setItemUpdated<ItemTypeType extends ApiItemType>(entry: ItemEntry<ItemTypeType>, fields: Partial<FieldMap<ItemTypeType>>, columnExpansion?: ColumnExpansion<ItemTypeType> | null, parent?: EntryParentNull, mode?: ChangesDeltaItemUpdateMode): this;
54
+ setItemDeleted(entry: ItemEntry, __isCascaded?: boolean): this;
55
+ setItemsDeleted(deleted: ItemEntry[]): this;
56
+ setItemDeletedCascaded(itemEntry: ItemEntry): this;
57
+ /**
58
+ * @description
59
+ * Fetches a template for the passed itemType and processes the passed values and sets the items to be created when the delta is applied
60
+ *
61
+ * @remark
62
+ * - If the values don't contain an `id` a new one will be generated
63
+ * - If you want to set a parent set the proper field, you can't pass it as a separate object
64
+ */
65
+ setItemsCreated<ItemTypeType extends ApiItemType, ColumnIds extends (keyof ApiFields[ItemTypeType])[] = (keyof ApiFields[ItemTypeType])[]>(itemType: ItemTypeType, valuesArray: Partial<FieldMap<ItemTypeType, ColumnIds>>[]): Promise<this>;
66
+ /**
67
+ * @description
68
+ * Will create an {@link ItemEntry ItemEntry} when the delta is applied
69
+ * Does not always mean the item is local, just that it isn't cached yet
70
+ *
71
+ * @remark
72
+ * If you're calling this from the frontend you probably want to call `setItemCreated`, which will fetch a template and process the values for you
73
+ * If you don't, you have to make sure the values are all correct and all template items are processed
74
+ *
75
+ * @internal
76
+ */
77
+ _setItemCreated<ItemTypeType extends ApiItemType, Fields extends Partial<FieldMap<ItemTypeType>>>(itemId: ItemId, fields: Fields, columns: ColumnSet<ItemTypeType>, parent?: EntryParentNull, isRoot?: boolean, isApiResponse?: boolean): this;
78
+ setItemRestored<ItemTypeType extends ApiItemType>(itemEntry: ItemEntry<ItemTypeType>, transactionItemEntryChanges: FieldMap<ItemTypeType>): void;
79
+ isEmpty(): boolean;
80
+ toJSON(): any;
81
+ }
@@ -0,0 +1,85 @@
1
+ import { ApiItemType, ItemId } from '@rentman/backend-types';
2
+ import { ChangesDelta, ChildChangesDelta, FieldMap, GetFieldValueType, ItemEntry, ItemEntryService, ItemTypeColumnId } from '../internal';
3
+ export type ChangesDeltaResult = {
4
+ /**
5
+ * The changes delta included in the changes delta result is not necessarily the same as the one being passed to
6
+ * the `applyChangesDelta()` method, as business logic rules might have been applied.
7
+ * TODO: Separate results for changes delta and child changes delta.
8
+ */
9
+ changesDelta: ChangesDelta | ChildChangesDelta;
10
+ created: ItemEntry[];
11
+ allChildrenDonePromise: Promise<void>;
12
+ };
13
+ export type ChangesDeltaItemUpdateMode =
14
+ /**
15
+ * For create/update responses you always want to overwrite whatever is cached
16
+ */
17
+ 'CLEAR_ALWAYS'
18
+ /**
19
+ * For socket messages you want to clear the user's changes if they are the same as what is received
20
+ */
21
+ | 'CLEAR_WHEN_SAME'
22
+ /**
23
+ * Used for query responses (you don't want to do anything with user changes)
24
+ */
25
+ | 'QUERY'
26
+ /**
27
+ * For user changes you want to store them if they are different than on a parent
28
+ */
29
+ | 'KEEP_WHEN_DIFFERENT';
30
+ /**
31
+ * @remark
32
+ * We explicitly keep track of the new parent, so we can set an item to moved if it isn't null (Needed for linkTo request)
33
+ */
34
+ export interface ChangesDeltaBaseItemUpdateDelta<ItemTypeType extends ApiItemType> {
35
+ entry: ItemEntry<ItemTypeType>;
36
+ changes: {
37
+ fields: FieldMap<ItemTypeType>;
38
+ };
39
+ mode: ChangesDeltaItemUpdateMode;
40
+ }
41
+ export interface ChangesDeltaBaseItemDeleteDelta<ItemTypeType extends ApiItemType> {
42
+ entry: ItemEntry<ItemTypeType>;
43
+ }
44
+ export declare abstract class ChangesDeltaBase<ItemDeleteDeltaType extends ChangesDeltaBaseItemDeleteDelta<any> = ChangesDeltaBaseItemDeleteDelta<any>> {
45
+ protected itemEntryService: ItemEntryService;
46
+ updated: {
47
+ [itemEntryId: number]: ChangesDeltaBaseItemUpdateDelta<any>;
48
+ };
49
+ protected deleted: {
50
+ [ItemType in ApiItemType]?: Map<ItemEntry<ItemType>, ItemDeleteDeltaType>;
51
+ };
52
+ /**
53
+ * @private
54
+ */
55
+ _queryResults: {
56
+ [itemType: string]: {
57
+ [queryString: string]: Set<ItemId>;
58
+ };
59
+ };
60
+ /**
61
+ * @private
62
+ * When set, only collections of this item type will be matched.
63
+ */
64
+ _queryItemTypeSet?: Set<ApiItemType>;
65
+ protected constructor(itemEntryService: ItemEntryService, queryItemTypes?: Iterable<ApiItemType>);
66
+ addQueryItemType(itemType: ApiItemType): void;
67
+ getUpdatedValue<ItemTypeType extends ApiItemType, ColumnId extends ItemTypeColumnId<ItemTypeType>>(itemEntry: ItemEntry<ItemTypeType>, columnId: ColumnId): GetFieldValueType<ItemTypeType, ColumnId> | undefined;
68
+ hasDeletedItem<ItemTypeType extends ApiItemType>(itemEntry: ItemEntry<ItemTypeType>): boolean;
69
+ hasUpdatedValue<ItemTypeType extends ApiItemType>(itemEntry: ItemEntry<ItemTypeType>, columnId: ItemTypeColumnId<ItemTypeType>): boolean;
70
+ getDeletedItemTypesIterator(): Generator<ApiItemType>;
71
+ getDeletedItemEntriesIterator<ItemTypeType extends ApiItemType>(itemType: ItemTypeType): Generator<ItemEntry<ItemTypeType>>;
72
+ getDeletedItemEntriesIterator(itemType?: undefined): Generator<ItemEntry<any>>;
73
+ getDeleteTuplesIterator(itemType?: ApiItemType): Generator<ItemDeleteDeltaType>;
74
+ isEmpty(): boolean;
75
+ /**
76
+ * @description
77
+ * Adds a hint for the {@link CollectionMatcherBase CacheSyncer] to the ChangesDelta, when the CollectionMatcher encounters a collection
78
+ * with the exact query, it will use the hint instead of running the matcher
79
+ *
80
+ * @private
81
+ */
82
+ _setQueryResult<ItemTypeType extends ApiItemType>(itemType: ItemTypeType, queryString: string, itemIds: Iterable<ItemId>): Set<ItemId>;
83
+ _getQueryResult<ItemTypeType extends ApiItemType>(itemType: ItemTypeType, queryString: string): Set<ItemId> | undefined;
84
+ protected setItemDeletedByTuple(deletedTuple: ItemDeleteDeltaType): this;
85
+ }
@@ -0,0 +1,35 @@
1
+ import { ApiRequestService, ChangesCompilationFactory, ChangesDeltaFactory, ErrorHandlerInterface, ItemIdConversionMap, RequestBufferManager, RequestColumnExpansionFactory, TransactionCache } from '../internal';
2
+ export type OnAfterCreateCallback = (conversionMap: ItemIdConversionMap) => void;
3
+ /**
4
+ * @description
5
+ * Executes the changes from a specific {@link TransactionCache transaction} and returns a {@link ChangesDelta ChangesDelta}
6
+ */
7
+ export declare class ChangesProcessor {
8
+ private apiRequestService;
9
+ private changesCompilationFactory;
10
+ private changesDeltaFactory;
11
+ private errorHandler;
12
+ private requestBufferManager;
13
+ private requestColumnExpansionFactory;
14
+ private transaction;
15
+ private breakUpByParent?;
16
+ private onAfterCreateCallback?;
17
+ private itemIdConversionMap;
18
+ private serverCache;
19
+ constructor(apiRequestService: ApiRequestService, changesCompilationFactory: ChangesCompilationFactory, changesDeltaFactory: ChangesDeltaFactory, errorHandler: ErrorHandlerInterface, requestBufferManager: RequestBufferManager, requestColumnExpansionFactory: RequestColumnExpansionFactory, transaction: TransactionCache, breakUpByParent?: boolean | undefined, onAfterCreateCallback?: OnAfterCreateCallback | undefined);
20
+ /**
21
+ * @description
22
+ * Executes the requests in the order of:
23
+ * 1. create
24
+ * 2. update
25
+ * 3. delete
26
+ */
27
+ execute(): Promise<ItemIdConversionMap>;
28
+ private getMapValue;
29
+ private executeCreateRequests;
30
+ private executeCreateRequest;
31
+ private executeUpdateRequests;
32
+ private executeUpdateRequest;
33
+ private executeDeleteRequests;
34
+ private executeDeleteRequest;
35
+ }