@stamhoofd/backend 2.118.1 → 2.120.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (362) hide show
  1. package/package.json +32 -22
  2. package/src/audit-logs/ModelLogger.ts +4 -2
  3. package/src/audit-logs/OrderLogger.ts +1 -1
  4. package/src/boot.ts +32 -14
  5. package/src/crons/balance-emails.ts +4 -2
  6. package/src/crons/clearExcelCache.test.ts +8 -8
  7. package/src/crons/update-cached-balances.ts +40 -14
  8. package/src/debug.ts +3 -2
  9. package/src/decoders/StringArrayDecoder.ts +1 -1
  10. package/src/decoders/StringNullableDecoder.ts +1 -1
  11. package/src/email-recipient-loaders/documents.ts +2 -1
  12. package/src/email-recipient-loaders/members.ts +2 -1
  13. package/src/email-recipient-loaders/orders.ts +2 -1
  14. package/src/email-recipient-loaders/payments.ts +6 -3
  15. package/src/email-recipient-loaders/receivable-balances.ts +2 -1
  16. package/src/email-recipient-loaders/registrations.ts +2 -1
  17. package/src/email-replacements/getEmailReplacementsForPayment.ts +8 -7
  18. package/src/endpoints/admin/members/ChargeMembersEndpoint.ts +7 -6
  19. package/src/endpoints/admin/memberships/ChargeMembershipsEndpoint.ts +3 -2
  20. package/src/endpoints/admin/memberships/GetChargeMembershipsSummaryEndpoint.ts +2 -1
  21. package/src/endpoints/admin/organizations/ChargeOrganizationsEndpoint.ts +4 -3
  22. package/src/endpoints/admin/organizations/GetOrganizationsCountEndpoint.ts +3 -2
  23. package/src/endpoints/admin/organizations/GetOrganizationsEndpoint.ts +7 -5
  24. package/src/endpoints/admin/organizations/PatchOrganizationsEndpoint.ts +12 -10
  25. package/src/endpoints/admin/registrations/ChargeRegistrationsEndpoint.ts +4 -3
  26. package/src/endpoints/auth/CreateAdminEndpoint.ts +8 -6
  27. package/src/endpoints/auth/CreateTokenEndpoint.ts +14 -12
  28. package/src/endpoints/auth/DeleteTokenEndpoint.ts +2 -1
  29. package/src/endpoints/auth/DeleteUserEndpoint.ts +2 -1
  30. package/src/endpoints/auth/ForgotPasswordEndpoint.ts +5 -4
  31. package/src/endpoints/auth/GetOtherUserEndpoint.ts +3 -2
  32. package/src/endpoints/auth/GetUserEndpoint.ts +3 -2
  33. package/src/endpoints/auth/OpenIDConnectAuthTokenEndpoint.ts +2 -1
  34. package/src/endpoints/auth/OpenIDConnectCallbackEndpoint.ts +4 -2
  35. package/src/endpoints/auth/OpenIDConnectStartEndpoint.ts +3 -2
  36. package/src/endpoints/auth/PatchUserEndpoint.ts +15 -12
  37. package/src/endpoints/auth/PollEmailVerificationEndpoint.ts +3 -2
  38. package/src/endpoints/auth/RetryEmailVerificationEndpoint.ts +3 -2
  39. package/src/endpoints/auth/SignupEndpoint.ts +5 -4
  40. package/src/endpoints/auth/VerifyEmailEndpoint.ts +6 -5
  41. package/src/endpoints/frontend/FrontendEnvironmentEndpoint.ts +3 -2
  42. package/src/endpoints/global/addresses/SearchRegionsEndpoint.ts +8 -5
  43. package/src/endpoints/global/addresses/ValidateAddressEndpoint.ts +5 -3
  44. package/src/endpoints/global/audit-logs/GetAuditLogsEndpoint.ts +8 -5
  45. package/src/endpoints/global/billing/ActivatePackagesEndpoint.ts +9 -7
  46. package/src/endpoints/global/billing/DeactivatePackageEndpoint.ts +4 -3
  47. package/src/endpoints/global/caddy/CheckDomainCertEndpoint.ts +4 -2
  48. package/src/endpoints/global/email/CreateEmailEndpoint.ts +9 -7
  49. package/src/endpoints/global/email/GetAdminEmailsEndpoint.test.ts +2 -1
  50. package/src/endpoints/global/email/GetAdminEmailsEndpoint.ts +22 -19
  51. package/src/endpoints/global/email/GetEmailAddressEndpoint.ts +6 -4
  52. package/src/endpoints/global/email/GetEmailEndpoint.ts +4 -3
  53. package/src/endpoints/global/email/GetUserEmailsEndpoint.test.ts +3 -2
  54. package/src/endpoints/global/email/GetUserEmailsEndpoint.ts +7 -4
  55. package/src/endpoints/global/email/ManageEmailAddressEndpoint.ts +7 -5
  56. package/src/endpoints/global/email/PatchEmailEndpoint.test.ts +11 -11
  57. package/src/endpoints/global/email/PatchEmailEndpoint.ts +14 -11
  58. package/src/endpoints/global/email-recipients/GetEmailRecipientsCountEndpoint.ts +3 -2
  59. package/src/endpoints/global/email-recipients/GetEmailRecipientsEndpoint.test.ts +2 -1
  60. package/src/endpoints/global/email-recipients/GetEmailRecipientsEndpoint.ts +8 -5
  61. package/src/endpoints/global/email-recipients/RetryEmailRecipientEndpoint.ts +7 -5
  62. package/src/endpoints/global/email-recipients/helpers/validateEmailRecipientFilter.ts +4 -3
  63. package/src/endpoints/global/events/GetEventNotificationsCountEndpoint.ts +3 -2
  64. package/src/endpoints/global/events/GetEventNotificationsEndpoint.ts +9 -6
  65. package/src/endpoints/global/events/GetEventsEndpoint.ts +7 -4
  66. package/src/endpoints/global/events/PatchEventNotificationsEndpoint.test.ts +4 -2
  67. package/src/endpoints/global/events/PatchEventNotificationsEndpoint.ts +17 -15
  68. package/src/endpoints/global/events/PatchEventsEndpoint.test.ts +4 -2
  69. package/src/endpoints/global/events/PatchEventsEndpoint.ts +28 -26
  70. package/src/endpoints/global/files/ExportToExcelEndpoint.ts +8 -5
  71. package/src/endpoints/global/files/GetFileCache.ts +5 -3
  72. package/src/endpoints/global/files/UploadFile.ts +10 -4
  73. package/src/endpoints/global/files/UploadImage.ts +4 -2
  74. package/src/endpoints/global/groups/GetGroupsEndpoint.test.ts +4 -2
  75. package/src/endpoints/global/groups/GetGroupsEndpoint.ts +8 -5
  76. package/src/endpoints/global/members/GetMemberFamilyEndpoint.ts +7 -5
  77. package/src/endpoints/global/members/GetMembersCountEndpoint.ts +3 -2
  78. package/src/endpoints/global/members/GetMembersEndpoint.test.ts +4 -2
  79. package/src/endpoints/global/members/GetMembersEndpoint.ts +10 -8
  80. package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.test.ts +257 -6
  81. package/src/endpoints/global/members/PatchOrganizationMembersEndpoint.ts +162 -107
  82. package/src/endpoints/global/members/helpers/validateGroupFilter.ts +4 -3
  83. package/src/endpoints/global/members/shouldCheckIfMemberIsDuplicate.ts +3 -2
  84. package/src/endpoints/global/organizations/CheckRegisterCodeEndpoint.ts +3 -2
  85. package/src/endpoints/global/organizations/CreateOrganizationEndpoint.test.ts +3 -2
  86. package/src/endpoints/global/organizations/CreateOrganizationEndpoint.ts +8 -7
  87. package/src/endpoints/global/organizations/GetOrganizationFromDomainEndpoint.ts +5 -3
  88. package/src/endpoints/global/organizations/GetOrganizationFromUriEndpoint.ts +5 -3
  89. package/src/endpoints/global/organizations/SearchOrganizationEndpoint.ts +8 -5
  90. package/src/endpoints/global/payments/StripeWebhookEndpoint.ts +4 -2
  91. package/src/endpoints/global/platform/GetPlatformAdminsEndpoint.ts +2 -1
  92. package/src/endpoints/global/platform/GetPlatformEndpoint.ts +3 -2
  93. package/src/endpoints/global/platform/PatchPlatformEnpoint.test.ts +3 -2
  94. package/src/endpoints/global/platform/PatchPlatformEnpoint.ts +7 -4
  95. package/src/endpoints/global/platform-memberships/GetPlatformMembershipsCountEndpoint.ts +47 -0
  96. package/src/endpoints/global/platform-memberships/GetPlatformMembershipsEndpoint.ts +206 -0
  97. package/src/endpoints/global/registration/GetRegistrationsCountEndpoint.ts +3 -2
  98. package/src/endpoints/global/registration/GetRegistrationsEndpoint.test.ts +2 -1
  99. package/src/endpoints/global/registration/GetRegistrationsEndpoint.ts +10 -7
  100. package/src/endpoints/global/registration/GetUserDetailedPayableBalanceEndpoint.ts +4 -2
  101. package/src/endpoints/global/registration/GetUserDocumentsEndpoint.ts +4 -2
  102. package/src/endpoints/global/registration/GetUserMembersEndpoint.ts +3 -2
  103. package/src/endpoints/global/registration/GetUserPayableBalanceEndpoint.ts +2 -1
  104. package/src/endpoints/global/registration/PatchUserMembersEndpoint.test.ts +5 -3
  105. package/src/endpoints/global/registration/PatchUserMembersEndpoint.ts +13 -9
  106. package/src/endpoints/global/registration/RegisterMembersEndpoint.test.ts +50 -49
  107. package/src/endpoints/global/registration/RegisterMembersEndpoint.ts +25 -22
  108. package/src/endpoints/global/registration-periods/GetRegistrationPeriodsEndpoint.ts +8 -5
  109. package/src/endpoints/global/registration-periods/PatchRegistrationPeriodsEndpoint.ts +9 -7
  110. package/src/endpoints/global/sso/GetSSOEndpoint.ts +4 -2
  111. package/src/endpoints/global/sso/SetSSOEndpoint.ts +3 -2
  112. package/src/endpoints/global/webshops/GetWebshopFromDomainEndpoint.ts +4 -2
  113. package/src/endpoints/global/webshops/GetWebshopsCountEndpoint.ts +43 -0
  114. package/src/endpoints/global/webshops/GetWebshopsEndpoint.test.ts +808 -0
  115. package/src/endpoints/global/webshops/GetWebshopsEndpoint.ts +221 -0
  116. package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemEndpoint.ts +4 -3
  117. package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemsCountEndpoint.ts +3 -2
  118. package/src/endpoints/organization/dashboard/balance-items/GetBalanceItemsEndpoint.ts +6 -4
  119. package/src/endpoints/organization/dashboard/balance-items/PatchBalanceItemsEndpoint.ts +15 -13
  120. package/src/endpoints/organization/dashboard/billing/GetOrganizationDetailedPayableBalanceEndpoint.ts +4 -2
  121. package/src/endpoints/organization/dashboard/billing/GetOrganizationPayableBalanceEndpoint.ts +4 -2
  122. package/src/endpoints/organization/dashboard/billing/GetPackagesEndpoint.ts +2 -1
  123. package/src/endpoints/organization/dashboard/documents/GetDocumentTemplateXML.ts +3 -2
  124. package/src/endpoints/organization/dashboard/documents/GetDocumentTemplatesCountEndpoint.ts +3 -2
  125. package/src/endpoints/organization/dashboard/documents/GetDocumentTemplatesEndpoint.ts +7 -4
  126. package/src/endpoints/organization/dashboard/documents/GetDocumentsCountEndpoint.ts +3 -2
  127. package/src/endpoints/organization/dashboard/documents/GetDocumentsEndpoint.ts +7 -4
  128. package/src/endpoints/organization/dashboard/documents/PatchDocumentEndpoint.ts +9 -7
  129. package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplatesEndpoint.test.ts +4 -2
  130. package/src/endpoints/organization/dashboard/documents/PatchDocumentTemplatesEndpoint.ts +7 -5
  131. package/src/endpoints/organization/dashboard/email/CheckEmailBouncesEndpoint.ts +3 -2
  132. package/src/endpoints/organization/dashboard/email-templates/GetEmailTemplatesEndpoint.test.ts +36 -1
  133. package/src/endpoints/organization/dashboard/email-templates/GetEmailTemplatesEndpoint.ts +13 -4
  134. package/src/endpoints/organization/dashboard/email-templates/PatchEmailTemplatesEndpoint.test.ts +4 -2
  135. package/src/endpoints/organization/dashboard/email-templates/PatchEmailTemplatesEndpoint.ts +7 -5
  136. package/src/endpoints/organization/dashboard/invoices/GetInvoicesCountEndpoint.ts +3 -2
  137. package/src/endpoints/organization/dashboard/invoices/GetInvoicesEndpoint.ts +6 -4
  138. package/src/endpoints/organization/dashboard/invoices/PatchInvoicesEndpoint.ts +5 -3
  139. package/src/endpoints/organization/dashboard/mollie/CheckMollieEndpoint.ts +4 -2
  140. package/src/endpoints/organization/dashboard/mollie/ConnectMollieEndpoint.ts +6 -3
  141. package/src/endpoints/organization/dashboard/mollie/DisconnectMollieEndpoint.ts +4 -2
  142. package/src/endpoints/organization/dashboard/mollie/GetMollieDashboardEndpoint.ts +2 -1
  143. package/src/endpoints/organization/dashboard/nolt/CreateNoltTokenEndpoint.ts +2 -1
  144. package/src/endpoints/organization/dashboard/organization/GetOrganizationArchivedGroups.ts +4 -2
  145. package/src/endpoints/organization/dashboard/organization/GetOrganizationDeletedGroups.ts +3 -2
  146. package/src/endpoints/organization/dashboard/organization/GetUitpasClientIdEndpoint.ts +2 -1
  147. package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.test.ts +5 -3
  148. package/src/endpoints/organization/dashboard/organization/PatchOrganizationEndpoint.ts +22 -19
  149. package/src/endpoints/organization/dashboard/organization/SearchUitpasOrganizersEndpoint.ts +5 -3
  150. package/src/endpoints/organization/dashboard/organization/SetOrganizationDomainEndpoint.ts +11 -9
  151. package/src/endpoints/organization/dashboard/organization/SetUitpasClientCredentialsEndpoint.ts +8 -7
  152. package/src/endpoints/organization/dashboard/payments/GetMemberBalanceEndpoint.ts +2 -1
  153. package/src/endpoints/organization/dashboard/payments/GetPaymentsCountEndpoint.ts +3 -2
  154. package/src/endpoints/organization/dashboard/payments/GetPaymentsEndpoint.ts +7 -5
  155. package/src/endpoints/organization/dashboard/payments/PatchPaymentsEndpoint.ts +18 -16
  156. package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalanceEndpoint.ts +2 -1
  157. package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalancesCountEndpoint.ts +3 -2
  158. package/src/endpoints/organization/dashboard/receivable-balances/GetReceivableBalancesEndpoint.ts +5 -3
  159. package/src/endpoints/organization/dashboard/registration-periods/GetOrganizationRegistrationPeriodsEndpoint.test.ts +2 -1
  160. package/src/endpoints/organization/dashboard/registration-periods/GetOrganizationRegistrationPeriodsEndpoint.ts +8 -5
  161. package/src/endpoints/organization/dashboard/registration-periods/MoveRegistrationPeriods.test.ts +4 -2
  162. package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.test.ts +4 -2
  163. package/src/endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.ts +32 -29
  164. package/src/endpoints/organization/dashboard/registration-periods/SetupStepReviewEndpoint.ts +6 -3
  165. package/src/endpoints/organization/dashboard/stripe/ConnectStripeEndpoint.ts +3 -2
  166. package/src/endpoints/organization/dashboard/stripe/DeleteStripeAccountEndpoint.ts +3 -2
  167. package/src/endpoints/organization/dashboard/stripe/GetStripeAccountLinkEndpoint.ts +5 -3
  168. package/src/endpoints/organization/dashboard/stripe/GetStripeAccountsEndpoint.ts +2 -1
  169. package/src/endpoints/organization/dashboard/stripe/GetStripeLoginLinkEndpoint.ts +5 -3
  170. package/src/endpoints/organization/dashboard/stripe/UpdateStripeAccountEndpoint.ts +3 -2
  171. package/src/endpoints/organization/dashboard/users/CreateApiUserEndpoint.ts +4 -3
  172. package/src/endpoints/organization/dashboard/users/DeleteUserEndpoint.ts +4 -3
  173. package/src/endpoints/organization/dashboard/users/GetApiUsersEndpoint.ts +3 -2
  174. package/src/endpoints/organization/dashboard/users/GetOrganizationAdminsEndpoint.ts +2 -1
  175. package/src/endpoints/organization/dashboard/users/PatchApiUserEndpoint.ts +6 -4
  176. package/src/endpoints/organization/dashboard/webshops/CreateWebshopEndpoint.ts +7 -6
  177. package/src/endpoints/organization/dashboard/webshops/DeleteWebshopEndpoint.ts +3 -2
  178. package/src/endpoints/organization/dashboard/webshops/GetDiscountCodesEndpoint.ts +4 -2
  179. package/src/endpoints/organization/dashboard/webshops/GetWebshopOrdersCountEndpoint.ts +3 -2
  180. package/src/endpoints/organization/dashboard/webshops/GetWebshopOrdersEndpoint.ts +7 -4
  181. package/src/endpoints/organization/dashboard/webshops/{GetWebshopTicketsCountEndpoint → GetWebshopTicketsCountEndpoint.ts} +7 -7
  182. package/src/endpoints/organization/dashboard/webshops/GetWebshopTicketsEndpoint.ts +9 -6
  183. package/src/endpoints/organization/dashboard/webshops/GetWebshopUriAvailabilityEndpoint.ts +4 -2
  184. package/src/endpoints/organization/dashboard/webshops/PatchDiscountCodesEndpoint.ts +6 -4
  185. package/src/endpoints/organization/dashboard/webshops/PatchWebshopEndpoint.ts +13 -12
  186. package/src/endpoints/organization/dashboard/webshops/PatchWebshopOrdersEndpoint.ts +4 -2
  187. package/src/endpoints/organization/dashboard/webshops/PatchWebshopTicketsEndpoint.ts +5 -3
  188. package/src/endpoints/organization/dashboard/webshops/SearchUitpasEventsEndpoint.ts +6 -4
  189. package/src/endpoints/organization/dashboard/webshops/VerifyWebshopDomainEndpoint.ts +2 -1
  190. package/src/endpoints/organization/shared/ExchangePaymentEndpoint.ts +6 -4
  191. package/src/endpoints/organization/shared/GetDocumentHtml.ts +4 -3
  192. package/src/endpoints/organization/shared/GetPaymentEndpoint.ts +4 -3
  193. package/src/endpoints/organization/shared/GetUitpasNumberDetailsEndpoint.ts +3 -2
  194. package/src/endpoints/organization/shared/auth/GetOrganizationEndpoint.ts +3 -2
  195. package/src/endpoints/organization/webshops/CheckWebshopDiscountCodesEndpoint.ts +4 -3
  196. package/src/endpoints/organization/webshops/GetOrderByPaymentEndpoint.ts +5 -4
  197. package/src/endpoints/organization/webshops/GetOrderEndpoint.ts +4 -3
  198. package/src/endpoints/organization/webshops/GetTicketsEndpoint.ts +7 -5
  199. package/src/endpoints/organization/webshops/GetWebshopEndpoint.ts +4 -3
  200. package/src/endpoints/organization/webshops/PlaceOrderEndpoint.test.ts +7 -3
  201. package/src/endpoints/organization/webshops/PlaceOrderEndpoint.ts +11 -10
  202. package/src/endpoints/organization/webshops/RetrieveUitpasSocialTariffPriceEndpoint.ts +5 -4
  203. package/src/endpoints/system/HealthEndpoint.test.ts +44 -0
  204. package/src/endpoints/system/HealthEndpoint.ts +14 -6
  205. package/src/excel-loaders/balance-items.ts +19 -17
  206. package/src/excel-loaders/event-notifications.ts +15 -13
  207. package/src/excel-loaders/index.ts +1 -0
  208. package/src/excel-loaders/members.ts +45 -43
  209. package/src/excel-loaders/organizations.ts +26 -25
  210. package/src/excel-loaders/payments.ts +44 -42
  211. package/src/excel-loaders/platform-memberships.ts +202 -0
  212. package/src/excel-loaders/receivable-balances.ts +25 -23
  213. package/src/excel-loaders/registrations.ts +30 -28
  214. package/src/helpers/AddressValidator.test.ts +2 -1
  215. package/src/helpers/AddressValidator.ts +13 -10
  216. package/src/helpers/AdminPermissionChecker.ts +193 -95
  217. package/src/helpers/AuthenticatedStructures.ts +13 -11
  218. package/src/helpers/BuckarooHelper.ts +3 -2
  219. package/src/helpers/Context.ts +8 -6
  220. package/src/helpers/CookieHelper.ts +2 -2
  221. package/src/helpers/FileCache.ts +9 -9
  222. package/src/helpers/ForwardHandler.ts +3 -2
  223. package/src/helpers/GlobalHelper.ts +2 -0
  224. package/src/helpers/GroupBuilder.ts +2 -1
  225. package/src/helpers/GroupedThrottledQueue.test.ts +19 -19
  226. package/src/helpers/LimitedFilteredRequestHelper.ts +1 -1
  227. package/src/helpers/MemberCharger.ts +2 -1
  228. package/src/helpers/MemberUserSyncer.ts +6 -3
  229. package/src/helpers/MembershipCharger.ts +2 -2
  230. package/src/helpers/OrganizationCharger.ts +2 -1
  231. package/src/helpers/PeriodHelper.ts +2 -1
  232. package/src/helpers/SQLTranslatedString.ts +3 -2
  233. package/src/helpers/ServiceFeeHelper.ts +1 -1
  234. package/src/helpers/SetupStepUpdater.ts +6 -5
  235. package/src/helpers/StripeHelper.ts +9 -8
  236. package/src/helpers/TagHelper.test.ts +5 -5
  237. package/src/helpers/TagHelper.ts +2 -1
  238. package/src/helpers/TemporaryMemberAccess.ts +2 -1
  239. package/src/helpers/ThrottledQueue.test.ts +20 -20
  240. package/src/helpers/UitpasTokenRepository.ts +7 -7
  241. package/src/helpers/ViesHelper.ts +5 -4
  242. package/src/helpers/XlsxTransformerColumnHelper.ts +21 -19
  243. package/src/helpers/email-html-helpers.ts +13 -12
  244. package/src/helpers/fetchToAsyncIterator.ts +1 -1
  245. package/src/helpers/outstandingBalanceJoin.ts +2 -1
  246. package/src/helpers/updateMemberDetailsUitpasNumber.ts +5 -4
  247. package/src/middleware/ContextMiddleware.ts +1 -1
  248. package/src/migrate.ts +21 -4
  249. package/src/seeds/0000000003-default-email-templates.ts +1 -1
  250. package/src/seeds/0000000004-single-organization.ts +2 -1
  251. package/src/seeds/1752848561-groups-registration-periods.ts +3 -2
  252. package/src/seeds/1754560914-groups-prices.test.ts +2 -1
  253. package/src/seeds/1754560914-groups-prices.ts +2 -1
  254. package/src/seeds/1755790070-fill-email-recipient-errors.ts +6 -6
  255. package/src/seeds/1755876819-remove-duplicate-members.ts +2 -1
  256. package/src/seeds/1765896674-document-update-year.test.ts +2 -1
  257. package/src/seeds/1773754928-force-save-members.ts +15 -0
  258. package/src/services/AuditLogService.ts +3 -2
  259. package/src/services/BalanceItemPaymentService.ts +2 -2
  260. package/src/services/BalanceItemService.ts +2 -1
  261. package/src/services/BootChecksService.test.ts +33 -0
  262. package/src/services/BootChecksService.ts +21 -0
  263. package/src/services/DatabaseCollationService.test.ts +18 -0
  264. package/src/services/DatabaseCollationService.ts +81 -0
  265. package/src/services/DocumentService.ts +1 -1
  266. package/src/services/EventNotificationService.ts +5 -4
  267. package/src/services/FileSignService.ts +2 -2
  268. package/src/services/InvoiceService.ts +3 -3
  269. package/src/services/MemberNumberService.ts +6 -4
  270. package/src/services/MemberRecordStore.ts +28 -19
  271. package/src/services/PaymentReallocationService.test.ts +2 -1
  272. package/src/services/PaymentReallocationService.ts +2 -1
  273. package/src/services/PaymentService.ts +28 -26
  274. package/src/services/RegistrationService.ts +65 -3
  275. package/src/services/SSOService.ts +13 -9
  276. package/src/services/STPackageService.ts +7 -5
  277. package/src/services/StartupHealthService.ts +15 -0
  278. package/src/services/uitpas/PassholderEndpoints.ts +2 -2
  279. package/src/services/uitpas/UitpasService.ts +11 -8
  280. package/src/services/uitpas/cancelTicketSales.ts +1 -1
  281. package/src/services/uitpas/checkPermissionsFor.ts +9 -9
  282. package/src/services/uitpas/getSocialTariffForEvent.ts +4 -4
  283. package/src/services/uitpas/getSocialTariffForUitpasNumbers.ts +5 -5
  284. package/src/services/uitpas/handleUitpasResponse.ts +1 -1
  285. package/src/services/uitpas/registerTicketSales.ts +4 -4
  286. package/src/services/uitpas/searchUitpasEvents.ts +3 -3
  287. package/src/services/uitpas/searchUitpasOrganizers.ts +3 -3
  288. package/src/sql-filters/audit-logs.ts +2 -1
  289. package/src/sql-filters/balance-item-payments.ts +2 -1
  290. package/src/sql-filters/balance-items.ts +2 -1
  291. package/src/sql-filters/base-registration-filter-compilers.ts +6 -4
  292. package/src/sql-filters/document-templates.ts +2 -1
  293. package/src/sql-filters/documents.ts +2 -1
  294. package/src/sql-filters/email-recipients.ts +2 -1
  295. package/src/sql-filters/emails.ts +2 -1
  296. package/src/sql-filters/event-notifications.ts +2 -1
  297. package/src/sql-filters/events.ts +2 -1
  298. package/src/sql-filters/groups.ts +2 -1
  299. package/src/sql-filters/invoiced-balance-items.ts +2 -1
  300. package/src/sql-filters/invoices.ts +2 -1
  301. package/src/sql-filters/member-responsibility-records.ts +2 -1
  302. package/src/sql-filters/members.ts +8 -7
  303. package/src/sql-filters/orders.ts +3 -2
  304. package/src/sql-filters/organization-registration-periods.ts +2 -1
  305. package/src/sql-filters/organizations.ts +2 -1
  306. package/src/sql-filters/payments.ts +2 -1
  307. package/src/sql-filters/platform-memberships.ts +67 -0
  308. package/src/sql-filters/receivable-balances.ts +2 -1
  309. package/src/sql-filters/registration-periods.ts +2 -1
  310. package/src/sql-filters/registrations.ts +2 -1
  311. package/src/sql-filters/tickets.ts +2 -1
  312. package/src/sql-filters/users.ts +2 -1
  313. package/src/sql-filters/webshops.ts +38 -0
  314. package/src/sql-sorters/audit-logs.ts +3 -2
  315. package/src/sql-sorters/balance-items.ts +3 -2
  316. package/src/sql-sorters/document-templates.ts +3 -2
  317. package/src/sql-sorters/documents.ts +3 -2
  318. package/src/sql-sorters/email-recipients.ts +3 -2
  319. package/src/sql-sorters/emails.ts +3 -2
  320. package/src/sql-sorters/event-notifications.ts +3 -2
  321. package/src/sql-sorters/events.ts +3 -2
  322. package/src/sql-sorters/groups.ts +3 -2
  323. package/src/sql-sorters/invoices.ts +3 -2
  324. package/src/sql-sorters/members.ts +3 -2
  325. package/src/sql-sorters/orders.ts +3 -2
  326. package/src/sql-sorters/organization-registration-periods.ts +3 -2
  327. package/src/sql-sorters/organizations.ts +3 -2
  328. package/src/sql-sorters/payments.ts +3 -2
  329. package/src/sql-sorters/platform-memberships.ts +40 -0
  330. package/src/sql-sorters/receivable-balances.ts +3 -2
  331. package/src/sql-sorters/registration-periods.ts +3 -2
  332. package/src/sql-sorters/registrations.ts +3 -2
  333. package/src/sql-sorters/tickets.ts +3 -2
  334. package/src/sql-sorters/webshops.ts +40 -0
  335. package/tests/actions/patchOrganizationMember.ts +5 -4
  336. package/tests/actions/patchPaymentStatus.ts +2 -2
  337. package/tests/actions/patchUserMember.ts +6 -4
  338. package/tests/e2e/api-rate-limits.test.ts +4 -5
  339. package/tests/e2e/bundle-discounts.test.ts +3 -2
  340. package/tests/e2e/charge-members.test.ts +7 -5
  341. package/tests/e2e/documents.test.ts +3 -2
  342. package/tests/e2e/private-files.test.ts +11 -13
  343. package/tests/e2e/register.test.ts +6 -5
  344. package/tests/e2e/stock.test.ts +6 -8
  345. package/tests/e2e/tickets.test.ts +4 -2
  346. package/tests/helpers/StripeMocker.ts +3 -3
  347. package/tests/init/initAdmin.ts +4 -2
  348. package/tests/init/initBundleDiscount.ts +3 -2
  349. package/tests/init/initPayconiq.ts +1 -1
  350. package/tests/init/initPermissionRole.ts +4 -2
  351. package/tests/init/initPlatformRecordCategory.ts +1 -1
  352. package/tests/init/initStripe.ts +1 -1
  353. package/tests/vitest.global.setup.ts +26 -0
  354. package/tests/{jest.setup.ts → vitest.setup.ts} +4 -3
  355. package/tsconfig.build.json +17 -0
  356. package/tsconfig.json +10 -41
  357. package/tsconfig.test.json +17 -0
  358. package/vitest.config.js +13 -0
  359. package/eslint.config.mjs +0 -5
  360. package/jest.config.cjs +0 -27
  361. package/tests/jest.global.setup.ts +0 -33
  362. package/tests/toMatchMap.ts +0 -68
@@ -3,8 +3,8 @@ import { Formatter } from '@stamhoofd/utility';
3
3
  import basex from 'base-x';
4
4
  import crypto from 'crypto';
5
5
  import fs from 'node:fs';
6
- import { Writable } from 'node:stream';
7
- import { Readable } from 'stream';
6
+ import type { Writable } from 'node:stream';
7
+ import type { Readable } from 'stream';
8
8
 
9
9
  const ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';
10
10
  const baseEncoder = basex(ALPHABET);
@@ -61,7 +61,7 @@ export class FileCache {
61
61
  throw new SimpleError({
62
62
  code: 'invalid_file',
63
63
  message: 'Invalid file',
64
- human: $t(`a175829f-1075-4e04-ab5f-8f65bb715635`),
64
+ human: $t(`%Fk`),
65
65
  statusCode: 400,
66
66
  });
67
67
  }
@@ -73,7 +73,7 @@ export class FileCache {
73
73
  throw new SimpleError({
74
74
  code: 'invalid_file',
75
75
  message: 'Invalid file',
76
- human: $t(`a175829f-1075-4e04-ab5f-8f65bb715635`),
76
+ human: $t(`%Fk`),
77
77
  statusCode: 400,
78
78
  });
79
79
  }
@@ -86,7 +86,7 @@ export class FileCache {
86
86
  throw new SimpleError({
87
87
  code: 'invalid_file',
88
88
  message: 'Invalid file',
89
- human: $t(`d5d7b908-50a5-4b3e-94d2-1e54e549764b`),
89
+ human: $t(`%Fl`),
90
90
  statusCode: 400,
91
91
  });
92
92
  }
@@ -99,7 +99,7 @@ export class FileCache {
99
99
  throw new SimpleError({
100
100
  code: 'invalid_file',
101
101
  message: 'Invalid file',
102
- human: $t(`594fab23-b257-4d51-8d7b-eb3e75bc48ba`),
102
+ human: $t(`%Fm`),
103
103
  statusCode: 400,
104
104
  });
105
105
  }
@@ -111,7 +111,7 @@ export class FileCache {
111
111
  throw new SimpleError({
112
112
  code: 'invalid_file',
113
113
  message: 'Invalid file',
114
- human: $t(`796645b6-ded0-4d1b-a439-0062f9b6edc1`),
114
+ human: $t(`%Fn`),
115
115
  statusCode: 400,
116
116
  });
117
117
  }
@@ -126,7 +126,7 @@ export class FileCache {
126
126
  throw new SimpleError({
127
127
  code: 'file_expired',
128
128
  message: 'File expired',
129
- human: $t(`8a9a35d5-ff86-48e3-81e1-42cf85708e06`),
129
+ human: $t(`%Fo`),
130
130
  statusCode: 404,
131
131
  });
132
132
  }
@@ -142,7 +142,7 @@ export class FileCache {
142
142
  throw new SimpleError({
143
143
  code: 'file_expired',
144
144
  message: 'File expired',
145
- human: $t(`d445388b-9062-488b-9fa7-d15682e26fd4`),
145
+ human: $t(`%Fp`),
146
146
  statusCode: 404,
147
147
  });
148
148
  }
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-unsafe-argument */
2
2
 
3
- import { Email, EmailAddress, EmailInterface, EmailInterfaceRecipient } from '@stamhoofd/email';
3
+ import type { EmailInterface, EmailInterfaceRecipient } from '@stamhoofd/email';
4
+ import { Email, EmailAddress } from '@stamhoofd/email';
4
5
  import { Organization, Platform } from '@stamhoofd/models';
5
6
  import { Formatter } from '@stamhoofd/utility';
6
7
  import { simpleParser } from 'mailparser';
@@ -67,7 +68,7 @@ export class ForwardHandler {
67
68
  let defaultEmail: EmailInterfaceRecipient[] = [Email.getWebmasterToEmail()];
68
69
  let organizationEmails: EmailInterfaceRecipient[] = [];
69
70
  const platform = await Platform.getShared();
70
- const extraDescription = $t(`24bc9aad-bc92-4d27-bfcd-055113d792fa`) + ' ' + email + $t(`97b9b042-c5b6-42dc-8238-e0e8392fcf26`) + ' ' + platform.config.name + ' ' + $t(`f510fb0c-c180-455a-8f23-7e09e344e47a`);
71
+ const extraDescription = $t(`%Fq`) + ' ' + email + $t(`%Fr`) + ' ' + platform.config.name + ' ' + $t(`%Fs`);
71
72
 
72
73
  function doBounce() {
73
74
  if (!from) {
@@ -9,7 +9,9 @@ export class GlobalHelper {
9
9
  await I18n.load();
10
10
  this.loadGlobalTranslateFunction();
11
11
  await FileSignService.load();
12
+
12
13
  MemberRecordStore.init();
14
+
13
15
  BalanceItemService.listen();
14
16
  }
15
17
 
@@ -1,5 +1,6 @@
1
1
  import { GroupCategory, GroupCategorySettings, GroupGenderType, GroupSettings, Group as GroupStruct, OrganizationGenderType, OrganizationType, OrganizationTypeHelper, TranslatedString, UmbrellaOrganization } from '@stamhoofd/structures';
2
- import { Group, Organization, OrganizationRegistrationPeriod, RegistrationPeriod } from '@stamhoofd/models';
2
+ import type { Organization} from '@stamhoofd/models';
3
+ import { Group, OrganizationRegistrationPeriod, RegistrationPeriod } from '@stamhoofd/models';
3
4
 
4
5
  export class GroupBuilder {
5
6
  organization: Organization;
@@ -3,19 +3,19 @@ import { GroupedThrottledQueue } from './GroupedThrottledQueue.js';
3
3
  describe('GroupedThrottledQueue', () => {
4
4
  // Mock timers for controlling setTimeout
5
5
  beforeEach(() => {
6
- jest.useFakeTimers();
6
+ vitest.useFakeTimers();
7
7
  });
8
8
 
9
9
  afterEach(() => {
10
- jest.useRealTimers();
10
+ vitest.useRealTimers();
11
11
  });
12
12
 
13
13
  afterAll(() => {
14
- jest.clearAllMocks();
14
+ vitest.clearAllMocks();
15
15
  });
16
16
 
17
17
  it('should create an instance with the provided handler', () => {
18
- const handler = jest.fn();
18
+ const handler = vitest.fn();
19
19
  const queue = new GroupedThrottledQueue(handler);
20
20
 
21
21
  expect(queue.handler).toBe(handler);
@@ -23,7 +23,7 @@ describe('GroupedThrottledQueue', () => {
23
23
  });
24
24
 
25
25
  it('should call handler when processing items from a group', async () => {
26
- const handler = jest.fn().mockResolvedValue(undefined);
26
+ const handler = vitest.fn().mockResolvedValue(undefined);
27
27
  const queue = new GroupedThrottledQueue<number>(handler);
28
28
 
29
29
  queue.addItem('group1', 1);
@@ -33,7 +33,7 @@ describe('GroupedThrottledQueue', () => {
33
33
  });
34
34
 
35
35
  it('should process items from different groups separately', async () => {
36
- const handler = jest.fn().mockResolvedValue(undefined);
36
+ const handler = vitest.fn().mockResolvedValue(undefined);
37
37
  const queue = new GroupedThrottledQueue<number>(handler);
38
38
 
39
39
  queue.addItem('group1', 1);
@@ -47,7 +47,7 @@ describe('GroupedThrottledQueue', () => {
47
47
  });
48
48
 
49
49
  it('should batch items from the same group', async () => {
50
- const handler = jest.fn().mockResolvedValue(undefined);
50
+ const handler = vitest.fn().mockResolvedValue(undefined);
51
51
  const queue = new GroupedThrottledQueue<number>(handler);
52
52
 
53
53
  queue.addItems('group1', [1, 2, 3]);
@@ -59,7 +59,7 @@ describe('GroupedThrottledQueue', () => {
59
59
  });
60
60
 
61
61
  it('should flush only the specified group', async () => {
62
- const handler = jest.fn().mockResolvedValue(undefined);
62
+ const handler = vitest.fn().mockResolvedValue(undefined);
63
63
  const queue = new GroupedThrottledQueue<number>(handler);
64
64
 
65
65
  queue.addItem('group1', 1);
@@ -77,7 +77,7 @@ describe('GroupedThrottledQueue', () => {
77
77
  });
78
78
 
79
79
  it('should remove the group when all items are processed', async () => {
80
- const handler = jest.fn().mockResolvedValue(undefined);
80
+ const handler = vitest.fn().mockResolvedValue(undefined);
81
81
  const queue = new GroupedThrottledQueue<number>(handler);
82
82
 
83
83
  queue.addItem('group1', 1);
@@ -93,7 +93,7 @@ describe('GroupedThrottledQueue', () => {
93
93
  });
94
94
 
95
95
  it('should handle multiple items added to the same group', async () => {
96
- const handler = jest.fn().mockResolvedValue(undefined);
96
+ const handler = vitest.fn().mockResolvedValue(undefined);
97
97
  const queue = new GroupedThrottledQueue<number>(handler);
98
98
 
99
99
  queue.addItem('group1', 1);
@@ -107,7 +107,7 @@ describe('GroupedThrottledQueue', () => {
107
107
  });
108
108
 
109
109
  it('should handle large batch sizes correctly', async () => {
110
- const handler = jest.fn().mockResolvedValue(undefined);
110
+ const handler = vitest.fn().mockResolvedValue(undefined);
111
111
  const queue = new GroupedThrottledQueue<number>(handler);
112
112
 
113
113
  // Create a large array of items
@@ -127,9 +127,9 @@ describe('GroupedThrottledQueue', () => {
127
127
  });
128
128
 
129
129
  it('should handle errors in handler without failing the queue', async () => {
130
- const consoleErrorMock = jest.spyOn(console, 'error').mockImplementation();
130
+ const consoleErrorMock = vitest.spyOn(console, 'error');// .mockImplementation();
131
131
 
132
- const handler = jest.fn().mockImplementation((group, items) => {
132
+ const handler = vitest.fn().mockImplementation((group, items) => {
133
133
  if (group === 'error-group') {
134
134
  throw new Error('Test error');
135
135
  }
@@ -155,7 +155,7 @@ describe('GroupedThrottledQueue', () => {
155
155
  it('should handle async handler functions', async () => {
156
156
  let processingPromise: Promise<void> | null = null;
157
157
 
158
- const handler = jest.fn().mockImplementation((group, items) => {
158
+ const handler = vitest.fn().mockImplementation((group, items) => {
159
159
  processingPromise = new Promise((resolve) => {
160
160
  setTimeout(() => {
161
161
  resolve();
@@ -174,7 +174,7 @@ describe('GroupedThrottledQueue', () => {
174
174
  expect(queue.queues.size).toBe(1);
175
175
 
176
176
  // Fast-forward time to resolve the processing promise
177
- jest.advanceTimersByTime(100);
177
+ vitest.advanceTimersByTime(100);
178
178
 
179
179
  // Wait for the processing to complete
180
180
  await waitPromise;
@@ -184,7 +184,7 @@ describe('GroupedThrottledQueue', () => {
184
184
  });
185
185
 
186
186
  it('should not error when flushing non-existing groups', async () => {
187
- const handler = jest.fn();
187
+ const handler = vitest.fn();
188
188
  const queue = new GroupedThrottledQueue<number>(handler);
189
189
 
190
190
  await expect(queue.flushGroupAndWait('non-existing')).resolves.not.toThrow();
@@ -194,21 +194,21 @@ describe('GroupedThrottledQueue', () => {
194
194
  });
195
195
 
196
196
  it('should automatically flush after maxDelay', async () => {
197
- const handler = jest.fn().mockResolvedValue(undefined);
197
+ const handler = vitest.fn().mockResolvedValue(undefined);
198
198
  const queue = new GroupedThrottledQueue(handler);
199
199
  queue.maxDelay = 1000; // Set a max delay for the timeout
200
200
 
201
201
  queue.addItem('group-1', 1);
202
202
  expect(queue.timeout).not.toBeNull();
203
203
 
204
- jest.advanceTimersByTime(500);
204
+ vitest.advanceTimersByTime(500);
205
205
 
206
206
  queue.addItem('group-2', 2);
207
207
  await queue.wait();
208
208
  expect(handler).not.toHaveBeenCalled();
209
209
 
210
210
  // Fast-forward time
211
- jest.advanceTimersByTime(500);
211
+ vitest.advanceTimersByTime(500);
212
212
 
213
213
  await queue.wait();
214
214
  expect(handler).toHaveBeenCalledWith('group-1', [1]);
@@ -1,5 +1,5 @@
1
1
  import { SimpleError } from '@simonbackx/simple-errors';
2
- import { SQLSortDefinitions } from '@stamhoofd/sql';
2
+ import type { SQLSortDefinitions } from '@stamhoofd/sql';
3
3
  import { getSortFilter, LimitedFilteredRequest } from '@stamhoofd/structures';
4
4
 
5
5
  export class LimitedFilteredRequestHelper {
@@ -1,5 +1,6 @@
1
1
  import { BalanceItem } from '@stamhoofd/models';
2
- import { BalanceItemType, MemberWithRegistrationsBlob } from '@stamhoofd/structures';
2
+ import type { MemberWithRegistrationsBlob } from '@stamhoofd/structures';
3
+ import { BalanceItemType } from '@stamhoofd/structures';
3
4
 
4
5
  export class MemberCharger {
5
6
  static async chargeMany({ chargingOrganizationId, membersToCharge, price, amount, description, dueAt, createdAt }: { chargingOrganizationId: string; membersToCharge: MemberWithRegistrationsBlob[]; price: number; amount?: number; description: string; dueAt: Date | null; createdAt: Date | null }) {
@@ -1,7 +1,9 @@
1
- import { CachedBalance, Member, MemberResponsibilityRecord, MemberWithUsers, Organization, Platform, User } from '@stamhoofd/models';
1
+ import type { MemberWithUsers } from '@stamhoofd/models';
2
+ import { CachedBalance, Member, MemberResponsibilityRecord, Organization, Platform, User } from '@stamhoofd/models';
2
3
  import { QueueHandler } from '@stamhoofd/queues';
3
4
  import { SQL } from '@stamhoofd/sql';
4
- import { AuditLogSource, MemberDetails, PermissionRole, Permissions, ReceivableBalanceType, UserPermissions } from '@stamhoofd/structures';
5
+ import type { MemberDetails, PermissionRole } from '@stamhoofd/structures';
6
+ import { AuditLogSource, Permissions, ReceivableBalanceType, UserPermissions } from '@stamhoofd/structures';
5
7
  import { Formatter } from '@stamhoofd/utility';
6
8
  import basex from 'base-x';
7
9
  import crypto from 'crypto';
@@ -96,7 +98,8 @@ export class MemberUserSyncerStatic {
96
98
  }
97
99
  }
98
100
 
99
- if (member.details.securityCode === null) {
101
+ // Generate security code (only for userMode platform)
102
+ if (STAMHOOFD.userMode !== 'organization' && member.details.securityCode === null) {
100
103
  console.log('Generating security code for member ' + member.id);
101
104
 
102
105
  const length = 16;
@@ -17,7 +17,7 @@ export const MembershipCharger = {
17
17
  throw new SimpleError({
18
18
  code: 'missing_membership_organization',
19
19
  message: 'Missing membershipOrganizationId',
20
- human: $t(`dd9d20ea-cf50-46be-8eb3-5c85bc5f30c8`),
20
+ human: $t(`%Ft`),
21
21
  });
22
22
  }
23
23
 
@@ -97,7 +97,7 @@ export const MembershipCharger = {
97
97
  const balanceItem = new BalanceItem();
98
98
  balanceItem.unitPrice = membership.price;
99
99
  balanceItem.amount = 1;
100
- balanceItem.description = Formatter.dateNumber(membership.startDate, true) + ' ' + $t(`3e515054-91e7-43ed-a9ce-563b626f337d`) + ' ' + Formatter.dateNumber(membership.expireDate ?? membership.endDate, true);
100
+ balanceItem.description = Formatter.dateNumber(membership.startDate, true) + ' ' + $t(`%10C`) + ' ' + Formatter.dateNumber(membership.expireDate ?? membership.endDate, true);
101
101
  balanceItem.relations = new Map([
102
102
  [
103
103
  BalanceItemRelationType.Member,
@@ -1,5 +1,6 @@
1
1
  import { BalanceItem } from '@stamhoofd/models';
2
- import { BalanceItemType, Organization as OrganizationStruct } from '@stamhoofd/structures';
2
+ import type { Organization as OrganizationStruct } from '@stamhoofd/structures';
3
+ import { BalanceItemType } from '@stamhoofd/structures';
3
4
 
4
5
  export class OrganizationCharger {
5
6
  static async chargeMany({ chargingOrganizationId, organizationsToCharge, price, amount, description, dueAt, createdAt }: { chargingOrganizationId: string; organizationsToCharge: OrganizationStruct[]; price: number; amount?: number; description: string; dueAt: Date | null; createdAt: Date | null }) {
@@ -1,5 +1,6 @@
1
1
  import { SimpleError } from '@simonbackx/simple-errors';
2
- import { Group, Member, MemberResponsibilityRecord, Organization, OrganizationRegistrationPeriod, Platform, RegistrationPeriod } from '@stamhoofd/models';
2
+ import type { RegistrationPeriod } from '@stamhoofd/models';
3
+ import { Group, Member, MemberResponsibilityRecord, Organization, OrganizationRegistrationPeriod, Platform } from '@stamhoofd/models';
3
4
  import { QueueHandler } from '@stamhoofd/queues';
4
5
  import { AuditLogSource, Group as GroupStruct, PermissionLevel } from '@stamhoofd/structures';
5
6
  import { PatchOrganizationRegistrationPeriodsEndpoint } from '../endpoints/organization/dashboard/registration-periods/PatchOrganizationRegistrationPeriodsEndpoint.js';
@@ -1,5 +1,6 @@
1
- import { SQLColumnExpression, SQLExpression, SQLExpressionOptions, SQLQuery, SQLTranslatedStringHelper } from '@stamhoofd/sql';
2
- import { Language } from '@stamhoofd/structures';
1
+ import type { SQLColumnExpression, SQLExpression, SQLExpressionOptions, SQLQuery } from '@stamhoofd/sql';
2
+ import { SQLTranslatedStringHelper } from '@stamhoofd/sql';
3
+ import { Language } from '@stamhoofd/types/Language';
3
4
 
4
5
  export class SQLTranslatedString implements SQLExpression {
5
6
  private helper: SQLTranslatedStringHelper;
@@ -1,4 +1,4 @@
1
- import { Organization, Payment } from '@stamhoofd/models';
1
+ import type { Organization, Payment } from '@stamhoofd/models';
2
2
  import { calculateVATPercentage, PaymentProvider, STPackageType } from '@stamhoofd/structures';
3
3
 
4
4
  export class ServiceFeeHelper {
@@ -11,14 +11,15 @@ import {
11
11
  } from '@stamhoofd/models';
12
12
  import { QueueHandler } from '@stamhoofd/queues';
13
13
  import { SQL, SQLWhereSign } from '@stamhoofd/sql';
14
+ import type {
15
+ MemberResponsibility,
16
+ Platform as PlatformStruct,
17
+ SetupSteps} from '@stamhoofd/structures';
14
18
  import {
15
19
  AuditLogSource,
16
20
  GroupType,
17
- MemberResponsibility,
18
- Platform as PlatformStruct,
19
21
  RecordCategory,
20
- SetupStepType,
21
- SetupSteps,
22
+ SetupStepType
22
23
  } from '@stamhoofd/structures';
23
24
  import { Formatter } from '@stamhoofd/utility';
24
25
  import { AuditLogService } from '../services/AuditLogService.js';
@@ -195,7 +196,7 @@ export class SetupStepUpdater {
195
196
  throw new SimpleError({
196
197
  code: 'not_found',
197
198
  message: 'Organization not found',
198
- human: $t(`e73b24c3-584d-4a0c-beae-c50f46c33d90`),
199
+ human: $t(`%Fu`),
199
200
  });
200
201
  }
201
202
 
@@ -1,6 +1,7 @@
1
1
  import { SimpleError } from '@simonbackx/simple-errors';
2
- import { I18n } from '@stamhoofd/backend-i18n';
3
- import { BalanceItem, BalanceItemPayment, Organization, Payment, StripeAccount, StripeCheckoutSession, StripePaymentIntent } from '@stamhoofd/models';
2
+ import type { I18n } from '@stamhoofd/backend-i18n';
3
+ import type { BalanceItem, BalanceItemPayment, Organization, StripeAccount} from '@stamhoofd/models';
4
+ import { Payment, StripeCheckoutSession, StripePaymentIntent } from '@stamhoofd/models';
4
5
  import { calculateVATPercentage, PaymentMethod, PaymentMethodHelper, PaymentStatus } from '@stamhoofd/structures';
5
6
  import { Formatter } from '@stamhoofd/utility';
6
7
  import Stripe from 'stripe';
@@ -11,7 +12,7 @@ export class StripeHelper {
11
12
  return new SimpleError({
12
13
  code: 'not_configured',
13
14
  message: 'Stripe is not yet configured for this platform',
14
- human: $t('4f1361c2-c860-46e7-a242-933bfe56a7ed'),
15
+ human: $t('%Fv'),
15
16
  });
16
17
  }
17
18
 
@@ -225,7 +226,7 @@ export class StripeHelper {
225
226
  if (!stripeAccount) {
226
227
  throw new SimpleError({
227
228
  code: '',
228
- message: $t(`b77e1f68-8928-42a2-802b-059fa73bedc3`, { method: PaymentMethodHelper.getName(payment.method) }),
229
+ message: $t(`%w3`, { method: PaymentMethodHelper.getName(payment.method) }),
229
230
  });
230
231
  }
231
232
 
@@ -235,7 +236,7 @@ export class StripeHelper {
235
236
  throw new SimpleError({
236
237
  code: 'minimum_amount',
237
238
  message: 'The minimum amount for an online payment is € 0,50',
238
- human: $t(`dae9058f-0aa7-4fcb-9f1d-fc918c65784b`),
239
+ human: $t(`%wl`),
239
240
  });
240
241
  }
241
242
 
@@ -280,7 +281,7 @@ export class StripeHelper {
280
281
  const paymentMethod = await stripe.paymentMethods.create({
281
282
  type: payment.method.toLowerCase() as 'bancontact' | 'ideal',
282
283
  billing_details: {
283
- name: payment.customer?.dynamicName || (customer.name.length > 2 ? customer.name : $t(`bd1e59c8-3d4c-4097-ab35-0ce7b20d0e50`)),
284
+ name: payment.customer?.dynamicName || (customer.name.length > 2 ? customer.name : $t(`%Gr`)),
284
285
  email: payment.customer?.dynamicEmail || customer.email,
285
286
  address: payment.customer?.company?.address
286
287
  ? {
@@ -319,7 +320,7 @@ export class StripeHelper {
319
320
  console.error('Stripe payment intent status is not requires_action', paymentIntent);
320
321
  throw new SimpleError({
321
322
  code: 'invalid_status',
322
- message: $t(`55d699ae-3da4-45ca-a30e-0f194b08edf7`) + ' ' + PaymentMethodHelper.getName(payment.method) + ' ' + $t(`277dc49e-922a-444f-ba2b-b3442d855358`),
323
+ message: $t(`%wm`) + ' ' + PaymentMethodHelper.getName(payment.method) + ' ' + $t(`%wn`),
323
324
  });
324
325
  }
325
326
 
@@ -387,7 +388,7 @@ export class StripeHelper {
387
388
  console.error('Stripe session has no url', session);
388
389
  throw new SimpleError({
389
390
  code: 'invalid_status',
390
- message: $t(`55d699ae-3da4-45ca-a30e-0f194b08edf7`) + ' ' + PaymentMethodHelper.getName(payment.method) + ' ' + $t(`277dc49e-922a-444f-ba2b-b3442d855358`),
391
+ message: $t(`%wm`) + ' ' + PaymentMethodHelper.getName(payment.method) + ' ' + $t(`%wn`),
391
392
  });
392
393
  }
393
394
  paymentUrl = session.url;
@@ -292,8 +292,8 @@ describe('TagHelper', () => {
292
292
  const result2 = TagHelper.validateTags(validPlatformTags);
293
293
 
294
294
  // assert
295
- expect(result1).toBeFalse();
296
- expect(result2).toBeTrue();
295
+ expect(result1).toBe(false);
296
+ expect(result2).toBe(true);
297
297
  });
298
298
 
299
299
  it('should return false if a tag is a child tag of multiple tags', () => {
@@ -339,8 +339,8 @@ describe('TagHelper', () => {
339
339
  const result2 = TagHelper.validateTags(validPlatformTags);
340
340
 
341
341
  // assert
342
- expect(result1).toBeFalse();
343
- expect(result2).toBeTrue();
342
+ expect(result1).toBe(false);
343
+ expect(result2).toBe(true);
344
344
  });
345
345
 
346
346
  it('should return false if the child tags contain an infinite loop', () => {
@@ -367,7 +367,7 @@ describe('TagHelper', () => {
367
367
  const result = TagHelper.validateTags(platformTagsWithInfiniteLoop);
368
368
 
369
369
  // assert
370
- expect(result).toBeFalse();
370
+ expect(result).toBe(false);
371
371
  });
372
372
  });
373
373
  });
@@ -1,6 +1,7 @@
1
1
  import { Organization, Platform } from '@stamhoofd/models';
2
2
  import { QueueHandler } from '@stamhoofd/queues';
3
- import { AuditLogSource, OrganizationTag, TagHelper as SharedTagHelper } from '@stamhoofd/structures';
3
+ import type { OrganizationTag} from '@stamhoofd/structures';
4
+ import { AuditLogSource, TagHelper as SharedTagHelper } from '@stamhoofd/structures';
4
5
  import { AuditLogService } from '../services/AuditLogService.js';
5
6
 
6
7
  export class TagHelper extends SharedTagHelper {
@@ -1,4 +1,5 @@
1
- import { getPermissionLevelNumber, PermissionLevel } from '@stamhoofd/structures';
1
+ import type { PermissionLevel } from '@stamhoofd/structures';
2
+ import { getPermissionLevelNumber } from '@stamhoofd/structures';
2
3
 
3
4
  const userMemberTemporaryAccessCache = new Map<string, { memberId: string; level: PermissionLevel; validUntil: Date }[]>();
4
5
 
@@ -3,19 +3,19 @@ import { ThrottledQueue } from './ThrottledQueue.js';
3
3
  describe('ThrottledQueue', () => {
4
4
  // Mock timers for controlling setTimeout
5
5
  beforeEach(() => {
6
- jest.useFakeTimers();
6
+ vitest.useFakeTimers();
7
7
  });
8
8
 
9
9
  afterEach(() => {
10
- jest.useRealTimers();
10
+ vitest.useRealTimers();
11
11
  });
12
12
 
13
13
  afterAll(() => {
14
- jest.clearAllMocks();
14
+ vitest.clearAllMocks();
15
15
  });
16
16
 
17
17
  it('should create an instance with the provided handler', () => {
18
- const handler = jest.fn();
18
+ const handler = vitest.fn();
19
19
  const queue = new ThrottledQueue(handler);
20
20
 
21
21
  expect(queue.handler).toBe(handler);
@@ -24,7 +24,7 @@ describe('ThrottledQueue', () => {
24
24
  });
25
25
 
26
26
  it('should add items to the queue', () => {
27
- const handler = jest.fn();
27
+ const handler = vitest.fn();
28
28
  const queue = new ThrottledQueue(handler);
29
29
 
30
30
  queue.addItem(1);
@@ -33,7 +33,7 @@ describe('ThrottledQueue', () => {
33
33
  });
34
34
 
35
35
  it('should add multiple items to the queue', () => {
36
- const handler = jest.fn();
36
+ const handler = vitest.fn();
37
37
  const queue = new ThrottledQueue(handler);
38
38
 
39
39
  queue.addItems([1, 2, 3]);
@@ -44,12 +44,12 @@ describe('ThrottledQueue', () => {
44
44
  });
45
45
 
46
46
  it('should flush automatically when reaching maxBatchSize', async () => {
47
- const handler = jest.fn().mockResolvedValue(undefined);
47
+ const handler = vitest.fn().mockResolvedValue(undefined);
48
48
  const queue = new ThrottledQueue(handler);
49
49
  queue.maxBatchSize = 3;
50
50
 
51
51
  // Spy on flushAll to check if it's called
52
- const flushAllSpy = jest.spyOn(queue, 'flushAll');
52
+ const flushAllSpy = vitest.spyOn(queue, 'flushAll');
53
53
 
54
54
  queue.addItems([1, 2]);
55
55
  expect(flushAllSpy).not.toHaveBeenCalled();
@@ -65,7 +65,7 @@ describe('ThrottledQueue', () => {
65
65
  });
66
66
 
67
67
  it('should process items in batches when exceeding maxBatchSize', async () => {
68
- const handler = jest.fn().mockResolvedValue(undefined);
68
+ const handler = vitest.fn().mockResolvedValue(undefined);
69
69
  const queue = new ThrottledQueue(handler);
70
70
  queue.maxBatchSize = 3;
71
71
 
@@ -88,9 +88,9 @@ describe('ThrottledQueue', () => {
88
88
  });
89
89
 
90
90
  it('should call emptyHandler when queue becomes empty', async () => {
91
- const handler = jest.fn().mockResolvedValue(undefined);
91
+ const handler = vitest.fn().mockResolvedValue(undefined);
92
92
  const queue = new ThrottledQueue(handler);
93
- const emptyHandler = jest.fn();
93
+ const emptyHandler = vitest.fn();
94
94
  queue.emptyHandler = emptyHandler;
95
95
 
96
96
  queue.maxBatchSize = 3;
@@ -101,9 +101,9 @@ describe('ThrottledQueue', () => {
101
101
  });
102
102
 
103
103
  it('should not call emptyHandler when queue is filled during processing', async () => {
104
- const handler = jest.fn().mockResolvedValue(undefined);
104
+ const handler = vitest.fn().mockResolvedValue(undefined);
105
105
  const queue = new ThrottledQueue(handler);
106
- const emptyHandler = jest.fn();
106
+ const emptyHandler = vitest.fn();
107
107
  queue.emptyHandler = emptyHandler;
108
108
 
109
109
  queue.maxBatchSize = 3;
@@ -120,11 +120,11 @@ describe('ThrottledQueue', () => {
120
120
 
121
121
  it('should not fail if handler throws an error', async () => {
122
122
  const error = new Error('Test error');
123
- const handler = jest.fn().mockRejectedValue(error);
123
+ const handler = vitest.fn().mockRejectedValue(error);
124
124
  const queue = new ThrottledQueue(handler);
125
125
 
126
126
  // Spy on console.error
127
- const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
127
+ const consoleErrorSpy = vitest.spyOn(console, 'error').mockImplementation(() => {});
128
128
 
129
129
  queue.addItem(1);
130
130
  await queue.flushAndWait();
@@ -137,7 +137,7 @@ describe('ThrottledQueue', () => {
137
137
  });
138
138
 
139
139
  it('should handle flushAndWait when queue is empty', async () => {
140
- const handler = jest.fn();
140
+ const handler = vitest.fn();
141
141
  const queue = new ThrottledQueue(handler);
142
142
 
143
143
  await queue.flushAndWait();
@@ -160,7 +160,7 @@ describe('ThrottledQueue', () => {
160
160
  });
161
161
 
162
162
  it('should handle startTimeout and stopTimeout correctly', async () => {
163
- const handler = jest.fn();
163
+ const handler = vitest.fn();
164
164
  const queue = new ThrottledQueue(handler);
165
165
  queue.maxDelay = 1000; // Set a max delay for the timeout
166
166
 
@@ -172,19 +172,19 @@ describe('ThrottledQueue', () => {
172
172
  });
173
173
 
174
174
  it('should automatically flush after maxDelay', async () => {
175
- const handler = jest.fn().mockResolvedValue(undefined);
175
+ const handler = vitest.fn().mockResolvedValue(undefined);
176
176
  const queue = new ThrottledQueue(handler);
177
177
  queue.maxDelay = 1000; // Set a max delay for the timeout
178
178
 
179
179
  queue.addItem(1);
180
180
  expect(queue.timeout).not.toBeNull();
181
181
 
182
- jest.advanceTimersByTime(500);
182
+ vitest.advanceTimersByTime(500);
183
183
  await queue.wait();
184
184
  expect(handler).not.toHaveBeenCalled();
185
185
 
186
186
  // Fast-forward time
187
- jest.advanceTimersByTime(500);
187
+ vitest.advanceTimersByTime(500);
188
188
 
189
189
  await queue.wait();
190
190
  expect(handler).toHaveBeenCalledWith([1]);