@stamhoofd/models 2.119.0 → 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 (1024) hide show
  1. package/dist/factories/AddressFactory.d.ts.map +1 -0
  2. package/dist/factories/AddressFactory.js +38 -0
  3. package/dist/factories/AddressFactory.js.map +1 -0
  4. package/dist/factories/BalanceItemFactory.d.ts +29 -0
  5. package/dist/factories/BalanceItemFactory.d.ts.map +1 -0
  6. package/dist/factories/BalanceItemFactory.js +56 -0
  7. package/dist/factories/BalanceItemFactory.js.map +1 -0
  8. package/dist/factories/DocumentTemplateFactory.d.ts +22 -0
  9. package/dist/factories/DocumentTemplateFactory.d.ts.map +1 -0
  10. package/dist/factories/DocumentTemplateFactory.js +145 -0
  11. package/dist/factories/DocumentTemplateFactory.js.map +1 -0
  12. package/dist/factories/EmailTemplateFactory.d.ts +18 -0
  13. package/dist/factories/EmailTemplateFactory.d.ts.map +1 -0
  14. package/dist/factories/EmailTemplateFactory.js +39 -0
  15. package/dist/factories/EmailTemplateFactory.js.map +1 -0
  16. package/dist/factories/EmergencyContactFactory.d.ts.map +1 -0
  17. package/dist/factories/EmergencyContactFactory.js +38 -0
  18. package/dist/factories/EmergencyContactFactory.js.map +1 -0
  19. package/dist/factories/EventFactory.d.ts +19 -0
  20. package/dist/factories/EventFactory.d.ts.map +1 -0
  21. package/dist/factories/EventFactory.js +31 -0
  22. package/dist/factories/EventFactory.js.map +1 -0
  23. package/dist/factories/EventNotificationFactory.d.ts +23 -0
  24. package/dist/factories/EventNotificationFactory.d.ts.map +1 -0
  25. package/dist/factories/EventNotificationFactory.js +40 -0
  26. package/dist/factories/EventNotificationFactory.js.map +1 -0
  27. package/dist/factories/EventNotificationTypeFactory.d.ts +12 -0
  28. package/dist/factories/EventNotificationTypeFactory.d.ts.map +1 -0
  29. package/dist/factories/EventNotificationTypeFactory.js +21 -0
  30. package/dist/factories/EventNotificationTypeFactory.js.map +1 -0
  31. package/dist/factories/GroupFactory.d.ts +27 -0
  32. package/dist/factories/GroupFactory.d.ts.map +1 -0
  33. package/dist/factories/GroupFactory.js +88 -0
  34. package/dist/factories/GroupFactory.js.map +1 -0
  35. package/dist/factories/MemberFactory.d.ts +26 -0
  36. package/dist/factories/MemberFactory.d.ts.map +1 -0
  37. package/dist/factories/MemberFactory.js +131 -0
  38. package/dist/factories/MemberFactory.js.map +1 -0
  39. package/dist/factories/MemberResponsibilityRecordFactory.d.ts +15 -0
  40. package/dist/factories/MemberResponsibilityRecordFactory.d.ts.map +1 -0
  41. package/dist/factories/MemberResponsibilityRecordFactory.js +30 -0
  42. package/dist/factories/MemberResponsibilityRecordFactory.js.map +1 -0
  43. package/dist/factories/OrganizationFactory.d.ts +20 -0
  44. package/dist/factories/OrganizationFactory.d.ts.map +1 -0
  45. package/dist/factories/OrganizationFactory.js +61 -0
  46. package/dist/factories/OrganizationFactory.js.map +1 -0
  47. package/dist/factories/OrganizationRegistrationPeriodFactory.d.ts +13 -0
  48. package/dist/factories/OrganizationRegistrationPeriodFactory.d.ts.map +1 -0
  49. package/dist/factories/OrganizationRegistrationPeriodFactory.js +16 -0
  50. package/dist/factories/OrganizationRegistrationPeriodFactory.js.map +1 -0
  51. package/dist/factories/OrganizationTagFactory.d.ts.map +1 -0
  52. package/dist/factories/OrganizationTagFactory.js +19 -0
  53. package/dist/factories/OrganizationTagFactory.js.map +1 -0
  54. package/dist/factories/ParentFactory.d.ts.map +1 -0
  55. package/dist/factories/ParentFactory.js +39 -0
  56. package/dist/factories/ParentFactory.js.map +1 -0
  57. package/dist/factories/PlatformEventTypeFactory.d.ts.map +1 -0
  58. package/dist/factories/PlatformEventTypeFactory.js +23 -0
  59. package/dist/factories/PlatformEventTypeFactory.js.map +1 -0
  60. package/dist/factories/PlatformResponsibilityFactory.d.ts.map +1 -0
  61. package/dist/factories/PlatformResponsibilityFactory.js +21 -0
  62. package/dist/factories/PlatformResponsibilityFactory.js.map +1 -0
  63. package/dist/factories/RecordAnswerFactory.d.ts +18 -0
  64. package/dist/factories/RecordAnswerFactory.d.ts.map +1 -0
  65. package/dist/factories/RecordAnswerFactory.js +91 -0
  66. package/dist/factories/RecordAnswerFactory.js.map +1 -0
  67. package/dist/factories/RecordCategoryFactory.d.ts +11 -0
  68. package/dist/factories/RecordCategoryFactory.d.ts.map +1 -0
  69. package/dist/factories/RecordCategoryFactory.js +19 -0
  70. package/dist/factories/RecordCategoryFactory.js.map +1 -0
  71. package/dist/factories/RecordFactory.d.ts.map +1 -0
  72. package/dist/factories/RecordFactory.js +16 -0
  73. package/dist/factories/RecordFactory.js.map +1 -0
  74. package/dist/factories/RegisterCodeFactory.d.ts.map +1 -0
  75. package/dist/factories/RegisterCodeFactory.js +14 -0
  76. package/dist/factories/RegisterCodeFactory.js.map +1 -0
  77. package/dist/factories/RegistrationFactory.d.ts +21 -0
  78. package/dist/factories/RegistrationFactory.d.ts.map +1 -0
  79. package/dist/factories/RegistrationFactory.js +21 -0
  80. package/dist/factories/RegistrationFactory.js.map +1 -0
  81. package/dist/factories/RegistrationPeriodFactory.d.ts +16 -0
  82. package/dist/factories/RegistrationPeriodFactory.d.ts.map +1 -0
  83. package/dist/factories/RegistrationPeriodFactory.js +30 -0
  84. package/dist/factories/RegistrationPeriodFactory.js.map +1 -0
  85. package/dist/factories/STPackageFactory.d.ts +15 -0
  86. package/dist/factories/STPackageFactory.d.ts.map +1 -0
  87. package/dist/factories/STPackageFactory.js +34 -0
  88. package/dist/factories/STPackageFactory.js.map +1 -0
  89. package/dist/factories/UserFactory.d.ts +22 -0
  90. package/dist/factories/UserFactory.d.ts.map +1 -0
  91. package/dist/factories/UserFactory.js +63 -0
  92. package/dist/factories/UserFactory.js.map +1 -0
  93. package/dist/factories/WebshopFactory.d.ts +17 -0
  94. package/dist/factories/WebshopFactory.d.ts.map +1 -0
  95. package/dist/factories/WebshopFactory.js +35 -0
  96. package/dist/factories/WebshopFactory.js.map +1 -0
  97. package/dist/factories/index.d.ts.map +1 -0
  98. package/dist/factories/index.js +27 -0
  99. package/dist/factories/index.js.map +1 -0
  100. package/dist/helpers/DNSValidator.d.ts +6 -0
  101. package/dist/helpers/DNSValidator.d.ts.map +1 -0
  102. package/dist/helpers/DNSValidator.js +142 -0
  103. package/dist/helpers/DNSValidator.js.map +1 -0
  104. package/dist/helpers/EmailBuilder.d.ts +88 -0
  105. package/dist/helpers/EmailBuilder.d.ts.map +1 -0
  106. package/dist/helpers/EmailBuilder.js +603 -0
  107. package/dist/helpers/EmailBuilder.js.map +1 -0
  108. package/dist/helpers/Handlebars.d.ts.map +1 -0
  109. package/dist/helpers/Handlebars.js +244 -0
  110. package/dist/helpers/Handlebars.js.map +1 -0
  111. package/dist/helpers/MemberMerger.d.ts.map +1 -0
  112. package/dist/helpers/MemberMerger.js +364 -0
  113. package/dist/helpers/MemberMerger.js.map +1 -0
  114. package/dist/helpers/RateLimiter.d.ts.map +1 -0
  115. package/dist/helpers/RateLimiter.js +64 -0
  116. package/dist/helpers/RateLimiter.js.map +1 -0
  117. package/dist/helpers/WebshopCounter.d.ts +8 -0
  118. package/dist/helpers/WebshopCounter.d.ts.map +1 -0
  119. package/dist/helpers/WebshopCounter.js +46 -0
  120. package/dist/helpers/WebshopCounter.js.map +1 -0
  121. package/dist/index.d.ts.map +1 -0
  122. package/dist/index.js +11 -0
  123. package/dist/index.js.map +1 -0
  124. package/dist/migrations/1605262045-import-postcodes.d.ts.map +1 -0
  125. package/dist/migrations/1605262045-import-postcodes.js +117 -0
  126. package/dist/migrations/1605262045-import-postcodes.js.map +1 -0
  127. package/dist/migrations/1605262046-import-postcodes-nl.d.ts.map +1 -0
  128. package/dist/migrations/1605262046-import-postcodes-nl.js +80 -0
  129. package/dist/migrations/1605262046-import-postcodes-nl.js.map +1 -0
  130. package/dist/migrations/1720080976-convert-charset-leads.d.ts +10 -0
  131. package/dist/migrations/1720080976-convert-charset-leads.d.ts.map +1 -0
  132. package/dist/migrations/1720080976-convert-charset-leads.js +41 -0
  133. package/dist/migrations/1720080976-convert-charset-leads.js.map +1 -0
  134. package/dist/models/AuditLog.d.ts.map +1 -0
  135. package/dist/models/AuditLog.js +94 -0
  136. package/dist/models/AuditLog.js.map +1 -0
  137. package/dist/models/BalanceItem.d.ts +218 -0
  138. package/dist/models/BalanceItem.d.ts.map +1 -0
  139. package/dist/models/BalanceItem.js +626 -0
  140. package/dist/models/BalanceItem.js.map +1 -0
  141. package/dist/models/BalanceItemPayment.d.ts +24 -0
  142. package/dist/models/BalanceItemPayment.d.ts.map +1 -0
  143. package/dist/models/BalanceItemPayment.js +65 -0
  144. package/dist/models/BalanceItemPayment.js.map +1 -0
  145. package/dist/models/BuckarooPayment.d.ts.map +1 -0
  146. package/dist/models/BuckarooPayment.js +24 -0
  147. package/dist/models/BuckarooPayment.js.map +1 -0
  148. package/dist/models/CachedBalance.d.ts +51 -0
  149. package/dist/models/CachedBalance.d.ts.map +1 -0
  150. package/dist/models/CachedBalance.js +390 -0
  151. package/dist/models/CachedBalance.js.map +1 -0
  152. package/dist/models/Document.d.ts +41 -0
  153. package/dist/models/Document.d.ts.map +1 -0
  154. package/dist/models/Document.js +251 -0
  155. package/dist/models/Document.js.map +1 -0
  156. package/dist/models/DocumentTemplate.d.ts +56 -0
  157. package/dist/models/DocumentTemplate.d.ts.map +1 -0
  158. package/dist/models/DocumentTemplate.js +719 -0
  159. package/dist/models/DocumentTemplate.js.map +1 -0
  160. package/dist/models/Email.d.ts +141 -0
  161. package/dist/models/Email.d.ts.map +1 -0
  162. package/dist/models/Email.js +1341 -0
  163. package/dist/models/Email.js.map +1 -0
  164. package/dist/models/EmailRecipient.d.ts.map +1 -0
  165. package/dist/models/EmailRecipient.js +194 -0
  166. package/dist/models/EmailRecipient.js.map +1 -0
  167. package/dist/models/EmailTemplate.d.ts +24 -0
  168. package/dist/models/EmailTemplate.d.ts.map +1 -0
  169. package/dist/models/EmailTemplate.js +79 -0
  170. package/dist/models/EmailTemplate.js.map +1 -0
  171. package/dist/models/EmailVerificationCode.d.ts +61 -0
  172. package/dist/models/EmailVerificationCode.d.ts.map +1 -0
  173. package/dist/models/EmailVerificationCode.js +339 -0
  174. package/dist/models/EmailVerificationCode.js.map +1 -0
  175. package/dist/models/Event.d.ts.map +1 -0
  176. package/dist/models/Event.js +132 -0
  177. package/dist/models/Event.js.map +1 -0
  178. package/dist/models/EventNotification.d.ts +32 -0
  179. package/dist/models/EventNotification.d.ts.map +1 -0
  180. package/dist/models/EventNotification.js +98 -0
  181. package/dist/models/EventNotification.js.map +1 -0
  182. package/dist/models/Group.d.ts +46 -0
  183. package/dist/models/Group.d.ts.map +1 -0
  184. package/dist/models/Group.js +213 -0
  185. package/dist/models/Group.js.map +1 -0
  186. package/dist/models/Image.d.ts +17 -0
  187. package/dist/models/Image.d.ts.map +1 -0
  188. package/dist/models/Image.js +169 -0
  189. package/dist/models/Image.js.map +1 -0
  190. package/dist/models/Invoice.d.ts.map +1 -0
  191. package/dist/models/Invoice.js +186 -0
  192. package/dist/models/Invoice.js.map +1 -0
  193. package/dist/models/InvoicedBalanceItem.d.ts +66 -0
  194. package/dist/models/InvoicedBalanceItem.d.ts.map +1 -0
  195. package/dist/models/InvoicedBalanceItem.js +130 -0
  196. package/dist/models/InvoicedBalanceItem.js.map +1 -0
  197. package/dist/models/Member.d.ts +114 -0
  198. package/dist/models/Member.d.ts.map +1 -0
  199. package/dist/models/Member.js +415 -0
  200. package/dist/models/Member.js.map +1 -0
  201. package/dist/models/MemberPlatformMembership.d.ts +48 -0
  202. package/dist/models/MemberPlatformMembership.d.ts.map +1 -0
  203. package/dist/models/MemberPlatformMembership.js +377 -0
  204. package/dist/models/MemberPlatformMembership.js.map +1 -0
  205. package/dist/models/MemberResponsibilityRecord.d.ts +17 -0
  206. package/dist/models/MemberResponsibilityRecord.d.ts.map +1 -0
  207. package/dist/models/MemberResponsibilityRecord.js +65 -0
  208. package/dist/models/MemberResponsibilityRecord.js.map +1 -0
  209. package/dist/models/MemberUser.d.ts.map +1 -0
  210. package/dist/models/MemberUser.js +22 -0
  211. package/dist/models/MemberUser.js.map +1 -0
  212. package/dist/models/MergedMember.d.ts +23 -0
  213. package/dist/models/MergedMember.d.ts.map +1 -0
  214. package/dist/models/MergedMember.js +123 -0
  215. package/dist/models/MergedMember.js.map +1 -0
  216. package/dist/models/MolliePayment.d.ts.map +1 -0
  217. package/dist/models/MolliePayment.js +24 -0
  218. package/dist/models/MolliePayment.js.map +1 -0
  219. package/dist/models/MollieToken.d.ts +45 -0
  220. package/dist/models/MollieToken.d.ts.map +1 -0
  221. package/dist/models/MollieToken.js +330 -0
  222. package/dist/models/MollieToken.js.map +1 -0
  223. package/dist/models/OneTimeToken.d.ts +38 -0
  224. package/dist/models/OneTimeToken.d.ts.map +1 -0
  225. package/dist/models/OneTimeToken.js +125 -0
  226. package/dist/models/OneTimeToken.js.map +1 -0
  227. package/dist/models/Order.d.ts +115 -0
  228. package/dist/models/Order.d.ts.map +1 -0
  229. package/dist/models/Order.js +908 -0
  230. package/dist/models/Order.js.map +1 -0
  231. package/dist/models/Organization.d.ts +128 -0
  232. package/dist/models/Organization.d.ts.map +1 -0
  233. package/dist/models/Organization.js +846 -0
  234. package/dist/models/Organization.js.map +1 -0
  235. package/dist/models/OrganizationRegistrationPeriod.d.ts +22 -0
  236. package/dist/models/OrganizationRegistrationPeriod.d.ts.map +1 -0
  237. package/dist/models/OrganizationRegistrationPeriod.js +129 -0
  238. package/dist/models/OrganizationRegistrationPeriod.js.map +1 -0
  239. package/dist/models/PasswordToken.d.ts +31 -0
  240. package/dist/models/PasswordToken.d.ts.map +1 -0
  241. package/dist/models/PasswordToken.js +129 -0
  242. package/dist/models/PasswordToken.js.map +1 -0
  243. package/dist/models/PayconiqPayment.d.ts +24 -0
  244. package/dist/models/PayconiqPayment.d.ts.map +1 -0
  245. package/dist/models/PayconiqPayment.js +272 -0
  246. package/dist/models/PayconiqPayment.js.map +1 -0
  247. package/dist/models/Payment.d.ts +120 -0
  248. package/dist/models/Payment.d.ts.map +1 -0
  249. package/dist/models/Payment.js +289 -0
  250. package/dist/models/Payment.js.map +1 -0
  251. package/dist/models/Platform.d.ts.map +1 -0
  252. package/dist/models/Platform.js +178 -0
  253. package/dist/models/Platform.js.map +1 -0
  254. package/dist/models/RegisterCode.d.ts.map +1 -0
  255. package/dist/models/RegisterCode.js +76 -0
  256. package/dist/models/RegisterCode.js.map +1 -0
  257. package/dist/models/Registration.d.ts +85 -0
  258. package/dist/models/Registration.d.ts.map +1 -0
  259. package/dist/models/Registration.js +190 -0
  260. package/dist/models/Registration.js.map +1 -0
  261. package/dist/models/RegistrationPeriod.d.ts.map +1 -0
  262. package/dist/models/RegistrationPeriod.js +140 -0
  263. package/dist/models/RegistrationPeriod.js.map +1 -0
  264. package/dist/models/STCredit.d.ts.map +1 -0
  265. package/dist/models/STCredit.js +61 -0
  266. package/dist/models/STCredit.js.map +1 -0
  267. package/dist/models/STInvoice.d.ts +37 -0
  268. package/dist/models/STInvoice.d.ts.map +1 -0
  269. package/dist/models/STInvoice.js +139 -0
  270. package/dist/models/STInvoice.js.map +1 -0
  271. package/dist/models/STPackage.d.ts.map +1 -0
  272. package/dist/models/STPackage.js +276 -0
  273. package/dist/models/STPackage.js.map +1 -0
  274. package/dist/models/STPendingInvoice.d.ts +26 -0
  275. package/dist/models/STPendingInvoice.d.ts.map +1 -0
  276. package/dist/models/STPendingInvoice.js +68 -0
  277. package/dist/models/STPendingInvoice.js.map +1 -0
  278. package/dist/models/StripeAccount.d.ts.map +1 -0
  279. package/dist/models/StripeAccount.js +81 -0
  280. package/dist/models/StripeAccount.js.map +1 -0
  281. package/dist/models/StripeCheckoutSession.d.ts.map +1 -0
  282. package/dist/models/StripeCheckoutSession.js +35 -0
  283. package/dist/models/StripeCheckoutSession.js.map +1 -0
  284. package/dist/models/StripePaymentIntent.d.ts.map +1 -0
  285. package/dist/models/StripePaymentIntent.js +35 -0
  286. package/dist/models/StripePaymentIntent.js.map +1 -0
  287. package/dist/models/Ticket.d.ts +65 -0
  288. package/dist/models/Ticket.d.ts.map +1 -0
  289. package/dist/models/Ticket.js +157 -0
  290. package/dist/models/Ticket.js.map +1 -0
  291. package/dist/models/Token.d.ts +48 -0
  292. package/dist/models/Token.d.ts.map +1 -0
  293. package/dist/models/Token.js +208 -0
  294. package/dist/models/Token.js.map +1 -0
  295. package/dist/models/UitpasClientCredential.d.ts.map +1 -0
  296. package/dist/models/UitpasClientCredential.js +62 -0
  297. package/dist/models/UitpasClientCredential.js.map +1 -0
  298. package/dist/models/UsedRegisterCode.d.ts.map +1 -0
  299. package/dist/models/UsedRegisterCode.js +58 -0
  300. package/dist/models/UsedRegisterCode.js.map +1 -0
  301. package/dist/models/User.d.ts +76 -0
  302. package/dist/models/User.d.ts.map +1 -0
  303. package/dist/models/User.js +484 -0
  304. package/dist/models/User.js.map +1 -0
  305. package/dist/models/UserPermissions.d.ts +16 -0
  306. package/dist/models/UserPermissions.d.ts.map +1 -0
  307. package/dist/models/UserPermissions.js +56 -0
  308. package/dist/models/UserPermissions.js.map +1 -0
  309. package/dist/models/Webshop.d.ts +45 -0
  310. package/dist/models/Webshop.d.ts.map +1 -0
  311. package/dist/models/Webshop.js +187 -0
  312. package/dist/models/Webshop.js.map +1 -0
  313. package/dist/models/WebshopDiscountCode.d.ts.map +1 -0
  314. package/dist/models/WebshopDiscountCode.js +89 -0
  315. package/dist/models/WebshopDiscountCode.js.map +1 -0
  316. package/dist/models/WebshopUitpasNumber.d.ts.map +1 -0
  317. package/dist/models/WebshopUitpasNumber.js +91 -0
  318. package/dist/models/WebshopUitpasNumber.js.map +1 -0
  319. package/dist/models/_relations.d.ts +8 -0
  320. package/dist/models/_relations.d.ts.map +1 -0
  321. package/dist/models/_relations.js +110 -0
  322. package/dist/models/_relations.js.map +1 -0
  323. package/dist/models/addresses/City.d.ts +15 -0
  324. package/dist/models/addresses/City.d.ts.map +1 -0
  325. package/dist/models/addresses/City.js +35 -0
  326. package/dist/models/addresses/City.js.map +1 -0
  327. package/dist/models/addresses/PostalCode.d.ts +21 -0
  328. package/dist/models/addresses/PostalCode.d.ts.map +1 -0
  329. package/dist/models/addresses/PostalCode.js +139 -0
  330. package/dist/models/addresses/PostalCode.js.map +1 -0
  331. package/dist/models/addresses/Province.d.ts +9 -0
  332. package/dist/models/addresses/Province.d.ts.map +1 -0
  333. package/dist/models/addresses/Province.js +24 -0
  334. package/dist/models/addresses/Province.js.map +1 -0
  335. package/dist/models/addresses/Street.d.ts.map +1 -0
  336. package/dist/models/addresses/Street.js +26 -0
  337. package/dist/models/addresses/Street.js.map +1 -0
  338. package/dist/models/index.d.ts +55 -0
  339. package/dist/models/index.d.ts.map +1 -0
  340. package/dist/models/index.js +55 -0
  341. package/dist/models/index.js.map +1 -0
  342. package/dist/structures/OrganizationServerMetaData.d.ts.map +1 -0
  343. package/dist/structures/OrganizationServerMetaData.js +130 -0
  344. package/dist/structures/OrganizationServerMetaData.js.map +1 -0
  345. package/package.json +13 -10
  346. package/src/factories/AddressFactory.ts +3 -2
  347. package/src/factories/BalanceItemFactory.ts +2 -1
  348. package/src/factories/DocumentTemplateFactory.ts +2 -1
  349. package/src/factories/EmailTemplateFactory.ts +3 -2
  350. package/src/factories/EmergencyContactFactory.ts +1 -1
  351. package/src/factories/EventFactory.ts +2 -2
  352. package/src/factories/EventNotificationFactory.ts +6 -4
  353. package/src/factories/EventNotificationTypeFactory.ts +2 -1
  354. package/src/factories/GroupFactory.ts +4 -3
  355. package/src/factories/MemberFactory.ts +6 -5
  356. package/src/factories/MemberResponsibilityRecordFactory.ts +3 -2
  357. package/src/factories/OrganizationFactory.ts +4 -2
  358. package/src/factories/OrganizationRegistrationPeriodFactory.ts +2 -2
  359. package/src/factories/ParentFactory.ts +1 -1
  360. package/src/factories/RecordAnswerFactory.ts +2 -1
  361. package/src/factories/RecordCategoryFactory.ts +4 -2
  362. package/src/factories/RegistrationFactory.ts +5 -4
  363. package/src/factories/RegistrationPeriodFactory.ts +2 -1
  364. package/src/factories/STPackageFactory.ts +1 -1
  365. package/src/factories/UserFactory.ts +3 -2
  366. package/src/factories/WebshopFactory.ts +3 -2
  367. package/src/helpers/DNSValidator.ts +2 -1
  368. package/src/helpers/EmailBuilder.ts +13 -4
  369. package/src/helpers/Handlebars.ts +3 -3
  370. package/src/helpers/MemberMerger.test.ts +1 -1
  371. package/src/helpers/MemberMerger.ts +5 -4
  372. package/src/helpers/WebshopCounter.ts +1 -1
  373. package/src/migrations/1605262045-import-postcodes.ts +1 -1
  374. package/src/migrations/1605262046-import-postcodes-nl.ts +2 -2
  375. package/src/migrations/1720080976-convert-charset-leads.ts +53 -0
  376. package/src/models/AuditLog.ts +2 -1
  377. package/src/models/BalanceItem.ts +4 -3
  378. package/src/models/BalanceItemPayment.ts +9 -6
  379. package/src/models/CachedBalance.test.ts +331 -0
  380. package/src/models/CachedBalance.ts +3 -2
  381. package/src/models/Document.ts +2 -2
  382. package/src/models/DocumentTemplate.ts +5 -3
  383. package/src/models/Email.test.ts +32 -31
  384. package/src/models/Email.ts +7 -4
  385. package/src/models/EmailTemplate.ts +2 -1
  386. package/src/models/EmailVerificationCode.ts +7 -5
  387. package/src/models/EventNotification.ts +3 -2
  388. package/src/models/Group.ts +5 -15
  389. package/src/models/Image.ts +2 -1
  390. package/src/models/InvoicedBalanceItem.ts +9 -8
  391. package/src/models/Member.ts +8 -4
  392. package/src/models/MemberPlatformMembership.ts +1 -1
  393. package/src/models/MemberResponsibilityRecord.ts +2 -1
  394. package/src/models/MergedMember.ts +1 -1
  395. package/src/models/MollieToken.ts +3 -3
  396. package/src/models/OneTimeToken.ts +1 -1
  397. package/src/models/Order.ts +17 -9
  398. package/src/models/Organization.ts +39 -11
  399. package/src/models/OrganizationRegistrationPeriod.ts +2 -2
  400. package/src/models/PasswordToken.ts +7 -5
  401. package/src/models/PayconiqPayment.ts +6 -3
  402. package/src/models/Payment.ts +8 -5
  403. package/src/models/Registration.ts +9 -97
  404. package/src/models/STInvoice.ts +1 -4
  405. package/src/models/STPackage.ts +1 -1
  406. package/src/models/STPendingInvoice.ts +5 -4
  407. package/src/models/Ticket.ts +11 -9
  408. package/src/models/Token.test.ts +2 -2
  409. package/src/models/Token.ts +6 -6
  410. package/src/models/User.ts +7 -8
  411. package/src/models/UserPermissions.ts +7 -6
  412. package/src/models/Webshop.ts +5 -5
  413. package/src/models/_relations.ts +133 -0
  414. package/src/models/addresses/City.ts +1 -1
  415. package/src/models/addresses/PostalCode.test.ts +1 -1
  416. package/src/models/addresses/PostalCode.ts +1 -1
  417. package/src/models/addresses/Province.ts +1 -1
  418. package/src/models/index.ts +22 -20
  419. package/src/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
  420. package/dist/src/factories/AddressFactory.d.ts.map +0 -1
  421. package/dist/src/factories/AddressFactory.js +0 -42
  422. package/dist/src/factories/AddressFactory.js.map +0 -1
  423. package/dist/src/factories/BalanceItemFactory.d.ts +0 -28
  424. package/dist/src/factories/BalanceItemFactory.d.ts.map +0 -1
  425. package/dist/src/factories/BalanceItemFactory.js +0 -60
  426. package/dist/src/factories/BalanceItemFactory.js.map +0 -1
  427. package/dist/src/factories/DocumentTemplateFactory.d.ts +0 -21
  428. package/dist/src/factories/DocumentTemplateFactory.d.ts.map +0 -1
  429. package/dist/src/factories/DocumentTemplateFactory.js +0 -149
  430. package/dist/src/factories/DocumentTemplateFactory.js.map +0 -1
  431. package/dist/src/factories/EmailTemplateFactory.d.ts +0 -18
  432. package/dist/src/factories/EmailTemplateFactory.d.ts.map +0 -1
  433. package/dist/src/factories/EmailTemplateFactory.js +0 -43
  434. package/dist/src/factories/EmailTemplateFactory.js.map +0 -1
  435. package/dist/src/factories/EmergencyContactFactory.d.ts.map +0 -1
  436. package/dist/src/factories/EmergencyContactFactory.js +0 -42
  437. package/dist/src/factories/EmergencyContactFactory.js.map +0 -1
  438. package/dist/src/factories/EventFactory.d.ts +0 -19
  439. package/dist/src/factories/EventFactory.d.ts.map +0 -1
  440. package/dist/src/factories/EventFactory.js +0 -35
  441. package/dist/src/factories/EventFactory.js.map +0 -1
  442. package/dist/src/factories/EventNotificationFactory.d.ts +0 -21
  443. package/dist/src/factories/EventNotificationFactory.d.ts.map +0 -1
  444. package/dist/src/factories/EventNotificationFactory.js +0 -44
  445. package/dist/src/factories/EventNotificationFactory.js.map +0 -1
  446. package/dist/src/factories/EventNotificationTypeFactory.d.ts +0 -11
  447. package/dist/src/factories/EventNotificationTypeFactory.d.ts.map +0 -1
  448. package/dist/src/factories/EventNotificationTypeFactory.js +0 -25
  449. package/dist/src/factories/EventNotificationTypeFactory.js.map +0 -1
  450. package/dist/src/factories/GroupFactory.d.ts +0 -26
  451. package/dist/src/factories/GroupFactory.d.ts.map +0 -1
  452. package/dist/src/factories/GroupFactory.js +0 -92
  453. package/dist/src/factories/GroupFactory.js.map +0 -1
  454. package/dist/src/factories/MemberFactory.d.ts +0 -26
  455. package/dist/src/factories/MemberFactory.d.ts.map +0 -1
  456. package/dist/src/factories/MemberFactory.js +0 -135
  457. package/dist/src/factories/MemberFactory.js.map +0 -1
  458. package/dist/src/factories/MemberResponsibilityRecordFactory.d.ts +0 -14
  459. package/dist/src/factories/MemberResponsibilityRecordFactory.d.ts.map +0 -1
  460. package/dist/src/factories/MemberResponsibilityRecordFactory.js +0 -34
  461. package/dist/src/factories/MemberResponsibilityRecordFactory.js.map +0 -1
  462. package/dist/src/factories/OrganizationFactory.d.ts +0 -19
  463. package/dist/src/factories/OrganizationFactory.d.ts.map +0 -1
  464. package/dist/src/factories/OrganizationFactory.js +0 -64
  465. package/dist/src/factories/OrganizationFactory.js.map +0 -1
  466. package/dist/src/factories/OrganizationRegistrationPeriodFactory.d.ts +0 -13
  467. package/dist/src/factories/OrganizationRegistrationPeriodFactory.d.ts.map +0 -1
  468. package/dist/src/factories/OrganizationRegistrationPeriodFactory.js +0 -20
  469. package/dist/src/factories/OrganizationRegistrationPeriodFactory.js.map +0 -1
  470. package/dist/src/factories/OrganizationTagFactory.d.ts.map +0 -1
  471. package/dist/src/factories/OrganizationTagFactory.js +0 -23
  472. package/dist/src/factories/OrganizationTagFactory.js.map +0 -1
  473. package/dist/src/factories/ParentFactory.d.ts.map +0 -1
  474. package/dist/src/factories/ParentFactory.js +0 -43
  475. package/dist/src/factories/ParentFactory.js.map +0 -1
  476. package/dist/src/factories/PlatformEventTypeFactory.d.ts.map +0 -1
  477. package/dist/src/factories/PlatformEventTypeFactory.js +0 -27
  478. package/dist/src/factories/PlatformEventTypeFactory.js.map +0 -1
  479. package/dist/src/factories/PlatformResponsibilityFactory.d.ts.map +0 -1
  480. package/dist/src/factories/PlatformResponsibilityFactory.js +0 -25
  481. package/dist/src/factories/PlatformResponsibilityFactory.js.map +0 -1
  482. package/dist/src/factories/RecordAnswerFactory.d.ts +0 -17
  483. package/dist/src/factories/RecordAnswerFactory.d.ts.map +0 -1
  484. package/dist/src/factories/RecordAnswerFactory.js +0 -95
  485. package/dist/src/factories/RecordAnswerFactory.js.map +0 -1
  486. package/dist/src/factories/RecordCategoryFactory.d.ts +0 -11
  487. package/dist/src/factories/RecordCategoryFactory.d.ts.map +0 -1
  488. package/dist/src/factories/RecordCategoryFactory.js +0 -23
  489. package/dist/src/factories/RecordCategoryFactory.js.map +0 -1
  490. package/dist/src/factories/RecordFactory.d.ts.map +0 -1
  491. package/dist/src/factories/RecordFactory.js +0 -21
  492. package/dist/src/factories/RecordFactory.js.map +0 -1
  493. package/dist/src/factories/RegisterCodeFactory.d.ts.map +0 -1
  494. package/dist/src/factories/RegisterCodeFactory.js +0 -18
  495. package/dist/src/factories/RegisterCodeFactory.js.map +0 -1
  496. package/dist/src/factories/RegistrationFactory.d.ts +0 -21
  497. package/dist/src/factories/RegistrationFactory.d.ts.map +0 -1
  498. package/dist/src/factories/RegistrationFactory.js +0 -25
  499. package/dist/src/factories/RegistrationFactory.js.map +0 -1
  500. package/dist/src/factories/RegistrationPeriodFactory.d.ts +0 -15
  501. package/dist/src/factories/RegistrationPeriodFactory.d.ts.map +0 -1
  502. package/dist/src/factories/RegistrationPeriodFactory.js +0 -34
  503. package/dist/src/factories/RegistrationPeriodFactory.js.map +0 -1
  504. package/dist/src/factories/STPackageFactory.d.ts +0 -15
  505. package/dist/src/factories/STPackageFactory.d.ts.map +0 -1
  506. package/dist/src/factories/STPackageFactory.js +0 -38
  507. package/dist/src/factories/STPackageFactory.js.map +0 -1
  508. package/dist/src/factories/UserFactory.d.ts +0 -22
  509. package/dist/src/factories/UserFactory.d.ts.map +0 -1
  510. package/dist/src/factories/UserFactory.js +0 -67
  511. package/dist/src/factories/UserFactory.js.map +0 -1
  512. package/dist/src/factories/WebshopFactory.d.ts +0 -16
  513. package/dist/src/factories/WebshopFactory.d.ts.map +0 -1
  514. package/dist/src/factories/WebshopFactory.js +0 -39
  515. package/dist/src/factories/WebshopFactory.js.map +0 -1
  516. package/dist/src/factories/index.d.ts.map +0 -1
  517. package/dist/src/factories/index.js +0 -30
  518. package/dist/src/factories/index.js.map +0 -1
  519. package/dist/src/helpers/DNSValidator.d.ts +0 -6
  520. package/dist/src/helpers/DNSValidator.d.ts.map +0 -1
  521. package/dist/src/helpers/DNSValidator.js +0 -145
  522. package/dist/src/helpers/DNSValidator.js.map +0 -1
  523. package/dist/src/helpers/EmailBuilder.d.ts +0 -83
  524. package/dist/src/helpers/EmailBuilder.d.ts.map +0 -1
  525. package/dist/src/helpers/EmailBuilder.js +0 -646
  526. package/dist/src/helpers/EmailBuilder.js.map +0 -1
  527. package/dist/src/helpers/Handlebars.d.ts.map +0 -1
  528. package/dist/src/helpers/Handlebars.js +0 -248
  529. package/dist/src/helpers/Handlebars.js.map +0 -1
  530. package/dist/src/helpers/MemberMerger.d.ts.map +0 -1
  531. package/dist/src/helpers/MemberMerger.js +0 -371
  532. package/dist/src/helpers/MemberMerger.js.map +0 -1
  533. package/dist/src/helpers/MemberMerger.test.d.ts +0 -2
  534. package/dist/src/helpers/MemberMerger.test.d.ts.map +0 -1
  535. package/dist/src/helpers/MemberMerger.test.js +0 -644
  536. package/dist/src/helpers/MemberMerger.test.js.map +0 -1
  537. package/dist/src/helpers/RateLimiter.d.ts.map +0 -1
  538. package/dist/src/helpers/RateLimiter.js +0 -69
  539. package/dist/src/helpers/RateLimiter.js.map +0 -1
  540. package/dist/src/helpers/WebshopCounter.d.ts +0 -8
  541. package/dist/src/helpers/WebshopCounter.d.ts.map +0 -1
  542. package/dist/src/helpers/WebshopCounter.js +0 -50
  543. package/dist/src/helpers/WebshopCounter.js.map +0 -1
  544. package/dist/src/index.d.ts.map +0 -1
  545. package/dist/src/index.js +0 -14
  546. package/dist/src/index.js.map +0 -1
  547. package/dist/src/migrations/1605262045-import-postcodes.js +0 -121
  548. package/dist/src/migrations/1605262046-import-postcodes-nl.js +0 -83
  549. package/dist/src/models/AuditLog.d.ts.map +0 -1
  550. package/dist/src/models/AuditLog.js +0 -98
  551. package/dist/src/models/AuditLog.js.map +0 -1
  552. package/dist/src/models/BalanceItem.d.ts +0 -217
  553. package/dist/src/models/BalanceItem.d.ts.map +0 -1
  554. package/dist/src/models/BalanceItem.js +0 -630
  555. package/dist/src/models/BalanceItem.js.map +0 -1
  556. package/dist/src/models/BalanceItemPayment.d.ts +0 -23
  557. package/dist/src/models/BalanceItemPayment.d.ts.map +0 -1
  558. package/dist/src/models/BalanceItemPayment.js +0 -70
  559. package/dist/src/models/BalanceItemPayment.js.map +0 -1
  560. package/dist/src/models/BuckarooPayment.d.ts.map +0 -1
  561. package/dist/src/models/BuckarooPayment.js +0 -28
  562. package/dist/src/models/BuckarooPayment.js.map +0 -1
  563. package/dist/src/models/CachedBalance.d.ts +0 -50
  564. package/dist/src/models/CachedBalance.d.ts.map +0 -1
  565. package/dist/src/models/CachedBalance.js +0 -394
  566. package/dist/src/models/CachedBalance.js.map +0 -1
  567. package/dist/src/models/Document.d.ts +0 -41
  568. package/dist/src/models/Document.d.ts.map +0 -1
  569. package/dist/src/models/Document.js +0 -255
  570. package/dist/src/models/Document.js.map +0 -1
  571. package/dist/src/models/DocumentTemplate.d.ts +0 -55
  572. package/dist/src/models/DocumentTemplate.d.ts.map +0 -1
  573. package/dist/src/models/DocumentTemplate.js +0 -723
  574. package/dist/src/models/DocumentTemplate.js.map +0 -1
  575. package/dist/src/models/DocumentTemplate.test.d.ts +0 -2
  576. package/dist/src/models/DocumentTemplate.test.d.ts.map +0 -1
  577. package/dist/src/models/DocumentTemplate.test.js +0 -57
  578. package/dist/src/models/DocumentTemplate.test.js.map +0 -1
  579. package/dist/src/models/Email.d.ts +0 -140
  580. package/dist/src/models/Email.d.ts.map +0 -1
  581. package/dist/src/models/Email.js +0 -1345
  582. package/dist/src/models/Email.js.map +0 -1
  583. package/dist/src/models/Email.test.d.ts +0 -2
  584. package/dist/src/models/Email.test.d.ts.map +0 -1
  585. package/dist/src/models/Email.test.js +0 -1036
  586. package/dist/src/models/Email.test.js.map +0 -1
  587. package/dist/src/models/EmailRecipient.d.ts.map +0 -1
  588. package/dist/src/models/EmailRecipient.js +0 -198
  589. package/dist/src/models/EmailRecipient.js.map +0 -1
  590. package/dist/src/models/EmailTemplate.d.ts +0 -23
  591. package/dist/src/models/EmailTemplate.d.ts.map +0 -1
  592. package/dist/src/models/EmailTemplate.js +0 -83
  593. package/dist/src/models/EmailTemplate.js.map +0 -1
  594. package/dist/src/models/EmailVerificationCode.d.ts +0 -59
  595. package/dist/src/models/EmailVerificationCode.d.ts.map +0 -1
  596. package/dist/src/models/EmailVerificationCode.js +0 -343
  597. package/dist/src/models/EmailVerificationCode.js.map +0 -1
  598. package/dist/src/models/Event.d.ts.map +0 -1
  599. package/dist/src/models/Event.js +0 -136
  600. package/dist/src/models/Event.js.map +0 -1
  601. package/dist/src/models/EventNotification.d.ts +0 -31
  602. package/dist/src/models/EventNotification.d.ts.map +0 -1
  603. package/dist/src/models/EventNotification.js +0 -102
  604. package/dist/src/models/EventNotification.js.map +0 -1
  605. package/dist/src/models/Group.d.ts +0 -45
  606. package/dist/src/models/Group.d.ts.map +0 -1
  607. package/dist/src/models/Group.js +0 -228
  608. package/dist/src/models/Group.js.map +0 -1
  609. package/dist/src/models/Image.d.ts +0 -16
  610. package/dist/src/models/Image.d.ts.map +0 -1
  611. package/dist/src/models/Image.js +0 -173
  612. package/dist/src/models/Image.js.map +0 -1
  613. package/dist/src/models/Invoice.d.ts.map +0 -1
  614. package/dist/src/models/Invoice.js +0 -190
  615. package/dist/src/models/Invoice.js.map +0 -1
  616. package/dist/src/models/InvoicedBalanceItem.d.ts +0 -66
  617. package/dist/src/models/InvoicedBalanceItem.d.ts.map +0 -1
  618. package/dist/src/models/InvoicedBalanceItem.js +0 -136
  619. package/dist/src/models/InvoicedBalanceItem.js.map +0 -1
  620. package/dist/src/models/Member.d.ts +0 -112
  621. package/dist/src/models/Member.d.ts.map +0 -1
  622. package/dist/src/models/Member.js +0 -415
  623. package/dist/src/models/Member.js.map +0 -1
  624. package/dist/src/models/MemberPlatformMembership.d.ts +0 -48
  625. package/dist/src/models/MemberPlatformMembership.d.ts.map +0 -1
  626. package/dist/src/models/MemberPlatformMembership.js +0 -381
  627. package/dist/src/models/MemberPlatformMembership.js.map +0 -1
  628. package/dist/src/models/MemberResponsibilityRecord.d.ts +0 -16
  629. package/dist/src/models/MemberResponsibilityRecord.d.ts.map +0 -1
  630. package/dist/src/models/MemberResponsibilityRecord.js +0 -69
  631. package/dist/src/models/MemberResponsibilityRecord.js.map +0 -1
  632. package/dist/src/models/MemberUser.d.ts.map +0 -1
  633. package/dist/src/models/MemberUser.js +0 -26
  634. package/dist/src/models/MemberUser.js.map +0 -1
  635. package/dist/src/models/MergedMember.d.ts +0 -23
  636. package/dist/src/models/MergedMember.d.ts.map +0 -1
  637. package/dist/src/models/MergedMember.js +0 -127
  638. package/dist/src/models/MergedMember.js.map +0 -1
  639. package/dist/src/models/MolliePayment.d.ts.map +0 -1
  640. package/dist/src/models/MolliePayment.js +0 -28
  641. package/dist/src/models/MolliePayment.js.map +0 -1
  642. package/dist/src/models/MollieToken.d.ts +0 -45
  643. package/dist/src/models/MollieToken.d.ts.map +0 -1
  644. package/dist/src/models/MollieToken.js +0 -334
  645. package/dist/src/models/MollieToken.js.map +0 -1
  646. package/dist/src/models/OneTimeToken.d.ts +0 -38
  647. package/dist/src/models/OneTimeToken.d.ts.map +0 -1
  648. package/dist/src/models/OneTimeToken.js +0 -129
  649. package/dist/src/models/OneTimeToken.js.map +0 -1
  650. package/dist/src/models/Order.d.ts +0 -112
  651. package/dist/src/models/Order.d.ts.map +0 -1
  652. package/dist/src/models/Order.js +0 -906
  653. package/dist/src/models/Order.js.map +0 -1
  654. package/dist/src/models/Organization.d.ts +0 -120
  655. package/dist/src/models/Organization.d.ts.map +0 -1
  656. package/dist/src/models/Organization.js +0 -828
  657. package/dist/src/models/Organization.js.map +0 -1
  658. package/dist/src/models/OrganizationRegistrationPeriod.d.ts +0 -22
  659. package/dist/src/models/OrganizationRegistrationPeriod.d.ts.map +0 -1
  660. package/dist/src/models/OrganizationRegistrationPeriod.js +0 -133
  661. package/dist/src/models/OrganizationRegistrationPeriod.js.map +0 -1
  662. package/dist/src/models/PasswordToken.d.ts +0 -30
  663. package/dist/src/models/PasswordToken.d.ts.map +0 -1
  664. package/dist/src/models/PasswordToken.js +0 -133
  665. package/dist/src/models/PasswordToken.js.map +0 -1
  666. package/dist/src/models/PayconiqPayment.d.ts +0 -22
  667. package/dist/src/models/PayconiqPayment.d.ts.map +0 -1
  668. package/dist/src/models/PayconiqPayment.js +0 -276
  669. package/dist/src/models/PayconiqPayment.js.map +0 -1
  670. package/dist/src/models/Payment.d.ts +0 -117
  671. package/dist/src/models/Payment.d.ts.map +0 -1
  672. package/dist/src/models/Payment.js +0 -293
  673. package/dist/src/models/Payment.js.map +0 -1
  674. package/dist/src/models/Platform.d.ts.map +0 -1
  675. package/dist/src/models/Platform.js +0 -182
  676. package/dist/src/models/Platform.js.map +0 -1
  677. package/dist/src/models/Platform.test.d.ts +0 -2
  678. package/dist/src/models/Platform.test.d.ts.map +0 -1
  679. package/dist/src/models/Platform.test.js +0 -90
  680. package/dist/src/models/Platform.test.js.map +0 -1
  681. package/dist/src/models/RegisterCode.d.ts.map +0 -1
  682. package/dist/src/models/RegisterCode.js +0 -80
  683. package/dist/src/models/RegisterCode.js.map +0 -1
  684. package/dist/src/models/Registration.d.ts +0 -93
  685. package/dist/src/models/Registration.d.ts.map +0 -1
  686. package/dist/src/models/Registration.js +0 -267
  687. package/dist/src/models/Registration.js.map +0 -1
  688. package/dist/src/models/RegistrationPeriod.d.ts.map +0 -1
  689. package/dist/src/models/RegistrationPeriod.js +0 -144
  690. package/dist/src/models/RegistrationPeriod.js.map +0 -1
  691. package/dist/src/models/STCredit.d.ts.map +0 -1
  692. package/dist/src/models/STCredit.js +0 -65
  693. package/dist/src/models/STCredit.js.map +0 -1
  694. package/dist/src/models/STInvoice.d.ts +0 -37
  695. package/dist/src/models/STInvoice.d.ts.map +0 -1
  696. package/dist/src/models/STInvoice.js +0 -145
  697. package/dist/src/models/STInvoice.js.map +0 -1
  698. package/dist/src/models/STPackage.d.ts.map +0 -1
  699. package/dist/src/models/STPackage.js +0 -280
  700. package/dist/src/models/STPackage.js.map +0 -1
  701. package/dist/src/models/STPendingInvoice.d.ts +0 -26
  702. package/dist/src/models/STPendingInvoice.d.ts.map +0 -1
  703. package/dist/src/models/STPendingInvoice.js +0 -73
  704. package/dist/src/models/STPendingInvoice.js.map +0 -1
  705. package/dist/src/models/StripeAccount.d.ts.map +0 -1
  706. package/dist/src/models/StripeAccount.js +0 -85
  707. package/dist/src/models/StripeAccount.js.map +0 -1
  708. package/dist/src/models/StripeCheckoutSession.d.ts.map +0 -1
  709. package/dist/src/models/StripeCheckoutSession.js +0 -39
  710. package/dist/src/models/StripeCheckoutSession.js.map +0 -1
  711. package/dist/src/models/StripePaymentIntent.d.ts.map +0 -1
  712. package/dist/src/models/StripePaymentIntent.js +0 -39
  713. package/dist/src/models/StripePaymentIntent.js.map +0 -1
  714. package/dist/src/models/Ticket.d.ts +0 -63
  715. package/dist/src/models/Ticket.d.ts.map +0 -1
  716. package/dist/src/models/Ticket.js +0 -162
  717. package/dist/src/models/Ticket.js.map +0 -1
  718. package/dist/src/models/Token.d.ts +0 -48
  719. package/dist/src/models/Token.d.ts.map +0 -1
  720. package/dist/src/models/Token.js +0 -212
  721. package/dist/src/models/Token.js.map +0 -1
  722. package/dist/src/models/Token.test.d.ts +0 -2
  723. package/dist/src/models/Token.test.d.ts.map +0 -1
  724. package/dist/src/models/Token.test.js +0 -60
  725. package/dist/src/models/Token.test.js.map +0 -1
  726. package/dist/src/models/UitpasClientCredential.d.ts.map +0 -1
  727. package/dist/src/models/UitpasClientCredential.js +0 -66
  728. package/dist/src/models/UitpasClientCredential.js.map +0 -1
  729. package/dist/src/models/UsedRegisterCode.d.ts.map +0 -1
  730. package/dist/src/models/UsedRegisterCode.js +0 -62
  731. package/dist/src/models/UsedRegisterCode.js.map +0 -1
  732. package/dist/src/models/User.d.ts +0 -77
  733. package/dist/src/models/User.d.ts.map +0 -1
  734. package/dist/src/models/User.js +0 -490
  735. package/dist/src/models/User.js.map +0 -1
  736. package/dist/src/models/UserPermissions.d.ts +0 -16
  737. package/dist/src/models/UserPermissions.d.ts.map +0 -1
  738. package/dist/src/models/UserPermissions.js +0 -61
  739. package/dist/src/models/UserPermissions.js.map +0 -1
  740. package/dist/src/models/Webshop.d.ts +0 -45
  741. package/dist/src/models/Webshop.d.ts.map +0 -1
  742. package/dist/src/models/Webshop.js +0 -192
  743. package/dist/src/models/Webshop.js.map +0 -1
  744. package/dist/src/models/WebshopDiscountCode.d.ts.map +0 -1
  745. package/dist/src/models/WebshopDiscountCode.js +0 -93
  746. package/dist/src/models/WebshopDiscountCode.js.map +0 -1
  747. package/dist/src/models/WebshopUitpasNumber.d.ts.map +0 -1
  748. package/dist/src/models/WebshopUitpasNumber.js +0 -95
  749. package/dist/src/models/WebshopUitpasNumber.js.map +0 -1
  750. package/dist/src/models/addresses/City.d.ts +0 -15
  751. package/dist/src/models/addresses/City.d.ts.map +0 -1
  752. package/dist/src/models/addresses/City.js +0 -39
  753. package/dist/src/models/addresses/City.js.map +0 -1
  754. package/dist/src/models/addresses/PostalCode.d.ts +0 -21
  755. package/dist/src/models/addresses/PostalCode.d.ts.map +0 -1
  756. package/dist/src/models/addresses/PostalCode.js +0 -143
  757. package/dist/src/models/addresses/PostalCode.js.map +0 -1
  758. package/dist/src/models/addresses/PostalCode.test.d.ts +0 -2
  759. package/dist/src/models/addresses/PostalCode.test.d.ts.map +0 -1
  760. package/dist/src/models/addresses/PostalCode.test.js +0 -98
  761. package/dist/src/models/addresses/PostalCode.test.js.map +0 -1
  762. package/dist/src/models/addresses/Province.d.ts +0 -9
  763. package/dist/src/models/addresses/Province.d.ts.map +0 -1
  764. package/dist/src/models/addresses/Province.js +0 -28
  765. package/dist/src/models/addresses/Province.js.map +0 -1
  766. package/dist/src/models/addresses/Street.d.ts.map +0 -1
  767. package/dist/src/models/addresses/Street.js +0 -30
  768. package/dist/src/models/addresses/Street.js.map +0 -1
  769. package/dist/src/models/index.d.ts +0 -54
  770. package/dist/src/models/index.d.ts.map +0 -1
  771. package/dist/src/models/index.js +0 -69
  772. package/dist/src/models/index.js.map +0 -1
  773. package/dist/src/structures/OrganizationServerMetaData.d.ts.map +0 -1
  774. package/dist/src/structures/OrganizationServerMetaData.js +0 -135
  775. package/dist/src/structures/OrganizationServerMetaData.js.map +0 -1
  776. package/dist/tests/jest.global.setup.d.ts +0 -3
  777. package/dist/tests/jest.global.setup.d.ts.map +0 -1
  778. package/dist/tests/jest.global.setup.js +0 -33
  779. package/dist/tests/jest.global.setup.js.map +0 -1
  780. package/dist/tests/jest.setup.d.ts +0 -2
  781. package/dist/tests/jest.setup.d.ts.map +0 -1
  782. package/dist/tests/jest.setup.js +0 -32
  783. package/dist/tests/jest.setup.js.map +0 -1
  784. package/dist/tsconfig.tsbuildinfo +0 -1
  785. /package/dist/{src/assets → assets}/Metropolis-Black.woff2 +0 -0
  786. /package/dist/{src/assets → assets}/Metropolis-BlackItalic.woff2 +0 -0
  787. /package/dist/{src/assets → assets}/Metropolis-Bold.woff2 +0 -0
  788. /package/dist/{src/assets → assets}/Metropolis-BoldItalic.woff2 +0 -0
  789. /package/dist/{src/assets → assets}/Metropolis-ExtraBold.woff2 +0 -0
  790. /package/dist/{src/assets → assets}/Metropolis-ExtraBoldItalic.woff2 +0 -0
  791. /package/dist/{src/assets → assets}/Metropolis-ExtraLight.woff2 +0 -0
  792. /package/dist/{src/assets → assets}/Metropolis-ExtraLightItalic.woff2 +0 -0
  793. /package/dist/{src/assets → assets}/Metropolis-Light.woff2 +0 -0
  794. /package/dist/{src/assets → assets}/Metropolis-LightItalic.woff2 +0 -0
  795. /package/dist/{src/assets → assets}/Metropolis-Medium.woff2 +0 -0
  796. /package/dist/{src/assets → assets}/Metropolis-MediumItalic.woff2 +0 -0
  797. /package/dist/{src/assets → assets}/Metropolis-Regular.woff2 +0 -0
  798. /package/dist/{src/assets → assets}/Metropolis-RegularItalic.woff2 +0 -0
  799. /package/dist/{src/assets → assets}/Metropolis-SemiBold.woff2 +0 -0
  800. /package/dist/{src/assets → assets}/Metropolis-SemiBoldItalic.woff2 +0 -0
  801. /package/dist/{src/assets → assets}/Metropolis-Thin.woff2 +0 -0
  802. /package/dist/{src/assets → assets}/Metropolis-ThinItalic.woff2 +0 -0
  803. /package/dist/{src/assets → assets}/logo.png +0 -0
  804. /package/dist/{src/factories → factories}/AddressFactory.d.ts +0 -0
  805. /package/dist/{src/factories → factories}/EmergencyContactFactory.d.ts +0 -0
  806. /package/dist/{src/factories → factories}/OrganizationTagFactory.d.ts +0 -0
  807. /package/dist/{src/factories → factories}/ParentFactory.d.ts +0 -0
  808. /package/dist/{src/factories → factories}/PlatformEventTypeFactory.d.ts +0 -0
  809. /package/dist/{src/factories → factories}/PlatformResponsibilityFactory.d.ts +0 -0
  810. /package/dist/{src/factories → factories}/RecordFactory.d.ts +0 -0
  811. /package/dist/{src/factories → factories}/RegisterCodeFactory.d.ts +0 -0
  812. /package/dist/{src/factories → factories}/index.d.ts +0 -0
  813. /package/dist/{src/helpers → helpers}/Handlebars.d.ts +0 -0
  814. /package/dist/{src/helpers → helpers}/MemberMerger.d.ts +0 -0
  815. /package/dist/{src/helpers → helpers}/RateLimiter.d.ts +0 -0
  816. /package/dist/{src/index.d.ts → index.d.ts} +0 -0
  817. /package/dist/{src/migrations → migrations}/1593773929-create-initial-tables.sql +0 -0
  818. /package/dist/{src/migrations → migrations}/1605261999-gemeenten-tmp.sql +0 -0
  819. /package/dist/{src/migrations → migrations}/1605262045-import-postcodes.d.ts +0 -0
  820. /package/dist/{src/migrations → migrations}/1605262046-import-postcodes-nl.d.ts +0 -0
  821. /package/dist/{src/migrations → migrations}/1605279038-drop-gemeenten-tmp.sql +0 -0
  822. /package/dist/{src/migrations → migrations}/1708607340-tickets-deleted-at.sql +0 -0
  823. /package/dist/{src/migrations → migrations}/1710459176-register-code-invoices.sql +0 -0
  824. /package/dist/{src/migrations → migrations}/1712158247-discount-codes.sql +0 -0
  825. /package/dist/{src/migrations → migrations}/1713178665-drop-invites.sql +0 -0
  826. /package/dist/{src/migrations → migrations}/1713178666-drop-keychain.sql +0 -0
  827. /package/dist/{src/migrations → migrations}/1713178667-drop-challenges.sql +0 -0
  828. /package/dist/{src/migrations → migrations}/1713178668-drop-user-keys.sql +0 -0
  829. /package/dist/{src/migrations → migrations}/1713178669-drop-organization-key.sql +0 -0
  830. /package/dist/{src/migrations → migrations}/1714985451-user-nullable-organization-id.sql +0 -0
  831. /package/dist/{src/migrations → migrations}/1714985452-email-verification-code-nullable-organization-id.sql +0 -0
  832. /package/dist/{src/migrations → migrations}/1714985453-user-organization-permissions.sql +0 -0
  833. /package/dist/{src/migrations → migrations}/1714985454-user-organization-permissions.sql +0 -0
  834. /package/dist/{src/migrations → migrations}/1715079362-platform.sql +0 -0
  835. /package/dist/{src/migrations → migrations}/1715181649-registrations-organization-id.sql +0 -0
  836. /package/dist/{src/migrations → migrations}/1715181650-registrations-organization-id-fill.sql +0 -0
  837. /package/dist/{src/migrations → migrations}/1715181651-registrations-organization-id-drop-null.sql +0 -0
  838. /package/dist/{src/migrations → migrations}/1716117067-members-nullable-organization-id.sql +0 -0
  839. /package/dist/{src/migrations → migrations}/1719567581-registration-periods.sql +0 -0
  840. /package/dist/{src/migrations → migrations}/1719567582-organization-registration-periods.sql +0 -0
  841. /package/dist/{src/migrations → migrations}/1719567881-organization-periodId.sql +0 -0
  842. /package/dist/{src/migrations → migrations}/1719567882-groups-periodId.sql +0 -0
  843. /package/dist/{src/migrations → migrations}/1719567883-platform-periodId.sql +0 -0
  844. /package/dist/{src/migrations → migrations}/1719568079-default-period.sql +0 -0
  845. /package/dist/{src/migrations → migrations}/1719568080-set-default-period-platform.sql +0 -0
  846. /package/dist/{src/migrations → migrations}/1719568081-set-default-period-organizations.sql +0 -0
  847. /package/dist/{src/migrations → migrations}/1719568082-set-default-period-groups.sql +0 -0
  848. /package/dist/{src/migrations → migrations}/1719580828-registrations-periodId.sql +0 -0
  849. /package/dist/{src/migrations → migrations}/1719580829-set-default-period-registrations.sql +0 -0
  850. /package/dist/{src/migrations → migrations}/1719931362-groups-default-age-group-id.sql +0 -0
  851. /package/dist/{src/migrations → migrations}/1720080975-convert-charset.sql +0 -0
  852. /package/dist/{src/migrations → migrations}/1720080976-responsibilities.sql +0 -0
  853. /package/dist/{src/migrations → migrations}/1720088136-member-membership-types.sql +0 -0
  854. /package/dist/{src/migrations → migrations}/1720088137-member-membership-types-expire-date.sql +0 -0
  855. /package/dist/{src/migrations → migrations}/1720444931-organization-active.sql +0 -0
  856. /package/dist/{src/migrations → migrations}/1721050380-email-table.sql +0 -0
  857. /package/dist/{src/migrations → migrations}/1721050381-email-recipients-table.sql +0 -0
  858. /package/dist/{src/migrations → migrations}/1721342679-responsibility-groupId.sql +0 -0
  859. /package/dist/{src/migrations → migrations}/1721342680-responsibility-groupId-foreign-key.sql +0 -0
  860. /package/dist/{src/migrations → migrations}/1721400546-users-memberId.sql +0 -0
  861. /package/dist/{src/migrations → migrations}/1721639159-membership-deleted-at.sql +0 -0
  862. /package/dist/{src/migrations → migrations}/1721639160-membership-generated.sql +0 -0
  863. /package/dist/{src/migrations → migrations}/1721841819-group-type.sql +0 -0
  864. /package/dist/{src/migrations → migrations}/1722090482-events.sql +0 -0
  865. /package/dist/{src/migrations → migrations}/1722269236-group-waitinglist-id.sql +0 -0
  866. /package/dist/{src/migrations → migrations}/1722525785-balance-item-paying-organization-id.sql +0 -0
  867. /package/dist/{src/migrations → migrations}/1722525787-depending-balance-item.sql +0 -0
  868. /package/dist/{src/migrations → migrations}/1722845608-registration-stock-reservations.sql +0 -0
  869. /package/dist/{src/migrations → migrations}/1722845609-group-stock-reservations.sql +0 -0
  870. /package/dist/{src/migrations → migrations}/1722852362-stripe-intents-account-id.sql +0 -0
  871. /package/dist/{src/migrations → migrations}/1722852363-stripe-checkout-sessions-account-id.sql +0 -0
  872. /package/dist/{src/migrations → migrations}/1722959111-allow-multiple-registrations.sql +0 -0
  873. /package/dist/{src/migrations → migrations}/1722963554-registration-group-price-and-options.sql +0 -0
  874. /package/dist/{src/migrations → migrations}/1723202125-member-number.sql +0 -0
  875. /package/dist/{src/migrations → migrations}/1723202126-member-number-index.sql +0 -0
  876. /package/dist/{src/migrations → migrations}/1723218160-balance-item-unit-price.sql +0 -0
  877. /package/dist/{src/migrations → migrations}/1723218161-balance-item-amount.sql +0 -0
  878. /package/dist/{src/migrations → migrations}/1723218162-balance-item-type.sql +0 -0
  879. /package/dist/{src/migrations → migrations}/1723218163-balance-item-type-defaults.sql +0 -0
  880. /package/dist/{src/migrations → migrations}/1723218164-balance-item-relations.sql +0 -0
  881. /package/dist/{src/migrations → migrations}/1723652795-payments-paying-user-id.sql +0 -0
  882. /package/dist/{src/migrations → migrations}/1723652796-payments-paying-organization-id.sql +0 -0
  883. /package/dist/{src/migrations → migrations}/1723652797-payments-paying-organization-id-fk.sql +0 -0
  884. /package/dist/{src/migrations → migrations}/1723652798-payments-customer.sql +0 -0
  885. /package/dist/{src/migrations → migrations}/1723736282-merged-members.sql +0 -0
  886. /package/dist/{src/migrations → migrations}/1724076162-setup-steps.sql +0 -0
  887. /package/dist/{src/migrations → migrations}/1724156666-member-indexes.sql +0 -0
  888. /package/dist/{src/migrations → migrations}/1724156667-organization-tag-index.sql +0 -0
  889. /package/dist/{src/migrations → migrations}/1724256125-membership-balance-item-id.sql +0 -0
  890. /package/dist/{src/migrations → migrations}/1724256126-membership-balance-item-fk.sql +0 -0
  891. /package/dist/{src/migrations → migrations}/1724258844-membershipOrganizationId.sql +0 -0
  892. /package/dist/{src/migrations → migrations}/1724258845-membershipOrganizationId-fk.sql +0 -0
  893. /package/dist/{src/migrations → migrations}/1726054851-balance-item-price-pending.sql +0 -0
  894. /package/dist/{src/migrations → migrations}/1726054852-cached-outstanding-balances.sql +0 -0
  895. /package/dist/{src/migrations → migrations}/1726668114-maximum-free-amount.sql +0 -0
  896. /package/dist/{src/migrations → migrations}/1726668115-free-amount.sql +0 -0
  897. /package/dist/{src/migrations → migrations}/1726668116-price-without-discount.sql +0 -0
  898. /package/dist/{src/migrations → migrations}/1727947041-registration-record-answers.sql +0 -0
  899. /package/dist/{src/migrations → migrations}/1729251385-order-extra-filter-columns.sql +0 -0
  900. /package/dist/{src/migrations → migrations}/1732285080-audit-logs.sql +0 -0
  901. /package/dist/{src/migrations → migrations}/1733129611-clear-audit-logs.sql +0 -0
  902. /package/dist/{src/migrations → migrations}/1733129612-audit-logs-source.sql +0 -0
  903. /package/dist/{src/migrations → migrations}/1733317908-added-missing-organization-fk-on-registrations.sql +0 -0
  904. /package/dist/{src/migrations → migrations}/1733317909-paying-organization-id-registrations.sql +0 -0
  905. /package/dist/{src/migrations → migrations}/1733317910-paying-organization-id-fk.sql +0 -0
  906. /package/dist/{src/migrations → migrations}/1733410641-audit-log-external-id.sql +0 -0
  907. /package/dist/{src/migrations → migrations}/1733418667-desc-audit-log-primary-key.sql +0 -0
  908. /package/dist/{src/migrations → migrations}/1733909398-balance-items-due-at.sql +0 -0
  909. /package/dist/{src/migrations → migrations}/1733909399-recalculate-at.sql +0 -0
  910. /package/dist/{src/migrations → migrations}/1733994454-balance-item-price-open.sql +0 -0
  911. /package/dist/{src/migrations → migrations}/1734084689-payment-type.sql +0 -0
  912. /package/dist/{src/migrations → migrations}/1734084690-move-payment-column-order.sql +0 -0
  913. /package/dist/{src/migrations → migrations}/1734084691-fill-payment-type-refunds.sql +0 -0
  914. /package/dist/{src/migrations → migrations}/1734084692-fill-payment-type-reallocations.sql +0 -0
  915. /package/dist/{src/migrations → migrations}/1734429094-registration-trial-until.sql +0 -0
  916. /package/dist/{src/migrations → migrations}/1734429095-membership-trial-until.sql +0 -0
  917. /package/dist/{src/migrations → migrations}/1734535120-registration-period-previous-period-id.sql +0 -0
  918. /package/dist/{src/migrations → migrations}/1734535121-platform-previous-period-id.sql +0 -0
  919. /package/dist/{src/migrations → migrations}/1734626607-cached-balance-amount-open.sql +0 -0
  920. /package/dist/{src/migrations → migrations}/1734698906-cached-balance-amount-paid.sql +0 -0
  921. /package/dist/{src/migrations → migrations}/1735573520-emails-email-type.sql +0 -0
  922. /package/dist/{src/migrations → migrations}/1735573521-email-recipients-email-type.sql +0 -0
  923. /package/dist/{src/migrations → migrations}/1735573522-emails-indexes.sql +0 -0
  924. /package/dist/{src/migrations → migrations}/1735982691-cached-balance-email-reminder-counts.sql +0 -0
  925. /package/dist/{src/migrations → migrations}/1736850097-audit-logs-meta.sql +0 -0
  926. /package/dist/{src/migrations → migrations}/1736947931-platform-server-config.sql +0 -0
  927. /package/dist/{src/migrations → migrations}/1738922428-membership-locked.sql +0 -0
  928. /package/dist/{src/migrations → migrations}/1739017508-event-notifications.sql +0 -0
  929. /package/dist/{src/migrations → migrations}/1739017509-event-notifications-link.sql +0 -0
  930. /package/dist/{src/migrations → migrations}/1739282590-event-notifications-submitted-at.sql +0 -0
  931. /package/dist/{src/migrations → migrations}/1741954610-event-notifications-accepted-record-answers.sql +0 -0
  932. /package/dist/{src/migrations → migrations}/1742579832-audit-log-longer-object-size.sql +0 -0
  933. /package/dist/{src/migrations → migrations}/1747913433-registration-discounts.sql +0 -0
  934. /package/dist/{src/migrations → migrations}/1747996262-balance-items-paid-at.sql +0 -0
  935. /package/dist/{src/migrations → migrations}/1747996263-balance-items-paid-at-fill.sql +0 -0
  936. /package/dist/{src/migrations → migrations}/1751633220-create-uitpas-client-credentials.sql +0 -0
  937. /package/dist/{src/migrations → migrations}/1751970372-create-webshop-uitpas-numbers.sql +0 -0
  938. /package/dist/{src/migrations → migrations}/1752655335-events-webshop-id.sql +0 -0
  939. /package/dist/{src/migrations → migrations}/1752678047-confirmation-email.sql +0 -0
  940. /package/dist/{src/migrations → migrations}/1753363434-service-fees.sql +0 -0
  941. /package/dist/{src/migrations → migrations}/1753430415-update-webshop-uitpasnumbers.sql +0 -0
  942. /package/dist/{src/migrations → migrations}/1755529026-email-sender-id.sql +0 -0
  943. /package/dist/{src/migrations → migrations}/1755789797-email-counts-errors.sql +0 -0
  944. /package/dist/{src/migrations → migrations}/1755789798-email-recipient-errors.sql +0 -0
  945. /package/dist/{src/migrations → migrations}/1756115313-email-recipient-ids-and-errors.sql +0 -0
  946. /package/dist/{src/migrations → migrations}/1756115314-email-recipient-email-optional.sql +0 -0
  947. /package/dist/{src/migrations → migrations}/1756115315-email-recipients-count.sql +0 -0
  948. /package/dist/{src/migrations → migrations}/1756115316-email-cached-counts.sql +0 -0
  949. /package/dist/{src/migrations → migrations}/1756115317-email-deleted-at.sql +0 -0
  950. /package/dist/{src/migrations → migrations}/1756293494-registration-period-next-period-id.sql +0 -0
  951. /package/dist/{src/migrations → migrations}/1756293495-platform-next-period-id.sql +0 -0
  952. /package/dist/{src/migrations → migrations}/1756387016-registration-period-custom-name.sql +0 -0
  953. /package/dist/{src/migrations → migrations}/1756391212-email-recipients-duplicate.sql +0 -0
  954. /package/dist/{src/migrations → migrations}/1756821154-email-send-as-email.sql +0 -0
  955. /package/dist/{src/migrations → migrations}/1758034021-email-recipient-previous-error.sql +0 -0
  956. /package/dist/{src/migrations → migrations}/1760535508-update-cached-balances-object-id-unique-constraint.sql +0 -0
  957. /package/dist/{src/migrations → migrations}/1761750780-renamed-invoice-organization-id.sql +0 -0
  958. /package/dist/{src/migrations → migrations}/1761750781-rename-index.sql +0 -0
  959. /package/dist/{src/migrations → migrations}/1761750782-invoices-add-organization-id.sql +0 -0
  960. /package/dist/{src/migrations → migrations}/1761750783-invoices-organization-id-fk.sql +0 -0
  961. /package/dist/{src/migrations → migrations}/1762521336-did-send-peppol.sql +0 -0
  962. /package/dist/{src/migrations → migrations}/1763216321-multiply-balance-item-payments.sql +0 -0
  963. /package/dist/{src/migrations → migrations}/1763216322-multiply-balance-items.sql +0 -0
  964. /package/dist/{src/migrations → migrations}/1763216323-bigint-cached-balances.sql +0 -0
  965. /package/dist/{src/migrations → migrations}/1763216324-multiply-cached-balances.sql +0 -0
  966. /package/dist/{src/migrations → migrations}/1763216325-multiply-member-platform-memberships.sql +0 -0
  967. /package/dist/{src/migrations → migrations}/1763216326-multiply-payments.sql +0 -0
  968. /package/dist/{src/migrations → migrations}/1763216327-multiply-register-codes.sql +0 -0
  969. /package/dist/{src/migrations → migrations}/1763216328-multiply-credits.sql +0 -0
  970. /package/dist/{src/migrations → migrations}/1763216329-multiply-orders.sql +0 -0
  971. /package/dist/{src/migrations → migrations}/1763216330-multiply-uitpas-numbers.sql +0 -0
  972. /package/dist/{src/migrations → migrations}/1763216331-balance-item-vat-percentages.sql +0 -0
  973. /package/dist/{src/migrations → migrations}/1763216332-balance-item-price-total.sql +0 -0
  974. /package/dist/{src/migrations → migrations}/1763216333-balance-item-price-total-fill.sql +0 -0
  975. /package/dist/{src/migrations → migrations}/1765895470-document-year.sql +0 -0
  976. /package/dist/{src/migrations → migrations}/1766150401-document-published-at.sql +0 -0
  977. /package/dist/{src/migrations → migrations}/1766410598-registration-end-date.sql +0 -0
  978. /package/dist/{src/migrations → migrations}/1769087807-invoices-table.sql +0 -0
  979. /package/dist/{src/migrations → migrations}/1769087808-invoiced-balance-items-table.sql +0 -0
  980. /package/dist/{src/migrations → migrations}/1769087809-payments-invoice-id.sql +0 -0
  981. /package/dist/{src/migrations → migrations}/1769621227-payments-rounding-amount.sql +0 -0
  982. /package/dist/{src/migrations → migrations}/1770917406-create-cached-balances-global-index.sql +0 -0
  983. /package/dist/{src/migrations → migrations}/1770917407-create-member-name-ordering-index.sql +0 -0
  984. /package/dist/{src/migrations → migrations}/1770917408-create-member-name-ordering-index-desc.sql +0 -0
  985. /package/dist/{src/migrations → migrations}/1770917409-create-member-age-ordering-index.sql +0 -0
  986. /package/dist/{src/migrations → migrations}/1770917410-create-member-age-ordering-index-desc.sql +0 -0
  987. /package/dist/{src/migrations → migrations}/1770917411-drop-duplicate-member-indexes.sql +0 -0
  988. /package/dist/{src/migrations → migrations}/1771510518-events-index-organization-id-start-date.sql +0 -0
  989. /package/dist/{src/migrations → migrations}/1771918307-membership-active-filter-index.sql +0 -0
  990. /package/dist/{src/migrations → migrations}/1772033555-balance-item-package-id.sql +0 -0
  991. /package/dist/{src/migrations → migrations}/1772033715-balance-item-start-end-date.sql +0 -0
  992. /package/dist/{src/migrations → migrations}/data/postcodes/nl/Drenthe +0 -0
  993. /package/dist/{src/migrations → migrations}/data/postcodes/nl/Flevoland +0 -0
  994. /package/dist/{src/migrations → migrations}/data/postcodes/nl/Friesland +0 -0
  995. /package/dist/{src/migrations → migrations}/data/postcodes/nl/Gelderland +0 -0
  996. /package/dist/{src/migrations → migrations}/data/postcodes/nl/Groningen +0 -0
  997. /package/dist/{src/migrations → migrations}/data/postcodes/nl/Limburg +0 -0
  998. /package/dist/{src/migrations → migrations}/data/postcodes/nl/Noord-Brabant +0 -0
  999. /package/dist/{src/migrations → migrations}/data/postcodes/nl/Noord-Holland +0 -0
  1000. /package/dist/{src/migrations → migrations}/data/postcodes/nl/Overrijsel +0 -0
  1001. /package/dist/{src/migrations → migrations}/data/postcodes/nl/Utrecht +0 -0
  1002. /package/dist/{src/migrations → migrations}/data/postcodes/nl/Zeeland +0 -0
  1003. /package/dist/{src/migrations → migrations}/data/postcodes/nl/Zuid-Holland +0 -0
  1004. /package/dist/{src/models → models}/AuditLog.d.ts +0 -0
  1005. /package/dist/{src/models → models}/BuckarooPayment.d.ts +0 -0
  1006. /package/dist/{src/models → models}/EmailRecipient.d.ts +0 -0
  1007. /package/dist/{src/models → models}/Event.d.ts +0 -0
  1008. /package/dist/{src/models → models}/Invoice.d.ts +0 -0
  1009. /package/dist/{src/models → models}/MemberUser.d.ts +0 -0
  1010. /package/dist/{src/models → models}/MolliePayment.d.ts +0 -0
  1011. /package/dist/{src/models → models}/Platform.d.ts +0 -0
  1012. /package/dist/{src/models → models}/RegisterCode.d.ts +0 -0
  1013. /package/dist/{src/models → models}/RegistrationPeriod.d.ts +0 -0
  1014. /package/dist/{src/models → models}/STCredit.d.ts +0 -0
  1015. /package/dist/{src/models → models}/STPackage.d.ts +0 -0
  1016. /package/dist/{src/models → models}/StripeAccount.d.ts +0 -0
  1017. /package/dist/{src/models → models}/StripeCheckoutSession.d.ts +0 -0
  1018. /package/dist/{src/models → models}/StripePaymentIntent.d.ts +0 -0
  1019. /package/dist/{src/models → models}/UitpasClientCredential.d.ts +0 -0
  1020. /package/dist/{src/models → models}/UsedRegisterCode.d.ts +0 -0
  1021. /package/dist/{src/models → models}/WebshopDiscountCode.d.ts +0 -0
  1022. /package/dist/{src/models → models}/WebshopUitpasNumber.d.ts +0 -0
  1023. /package/dist/{src/models → models}/addresses/Street.d.ts +0 -0
  1024. /package/dist/{src/structures → structures}/OrganizationServerMetaData.d.ts +0 -0
@@ -1,1345 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Email = void 0;
4
- const tslib_1 = require("tslib");
5
- const simple_database_1 = require("@simonbackx/simple-database");
6
- const structures_1 = require("@stamhoofd/structures");
7
- const uuid_1 = require("uuid");
8
- const simple_encoding_1 = require("@simonbackx/simple-encoding");
9
- const simple_errors_1 = require("@simonbackx/simple-errors");
10
- const backend_i18n_1 = require("@stamhoofd/backend-i18n");
11
- const email_1 = require("@stamhoofd/email");
12
- const queues_1 = require("@stamhoofd/queues");
13
- const sql_1 = require("@stamhoofd/sql");
14
- const EmailBuilder_js_1 = require("../helpers/EmailBuilder.js");
15
- const EmailRecipient_js_1 = require("./EmailRecipient.js");
16
- const EmailTemplate_js_1 = require("./EmailTemplate.js");
17
- const Organization_js_1 = require("./Organization.js");
18
- const Platform_js_1 = require("./Platform.js");
19
- const User_js_1 = require("./User.js");
20
- function errorToSimpleErrors(e) {
21
- if ((0, simple_errors_1.isSimpleErrors)(e)) {
22
- return e;
23
- }
24
- else if ((0, simple_errors_1.isSimpleError)(e)) {
25
- return new simple_errors_1.SimpleErrors(e);
26
- }
27
- else {
28
- return new simple_errors_1.SimpleErrors(new simple_errors_1.SimpleError({
29
- code: 'unknown_error',
30
- message: ((typeof e === 'object' && e !== null && 'message' in e && typeof e.message === 'string') ? e.message : 'Unknown error'),
31
- human: $t(`%1ED`),
32
- }));
33
- }
34
- }
35
- class Email extends sql_1.QueryableModel {
36
- static table = 'emails';
37
- id;
38
- organizationId = null;
39
- senderId = null;
40
- userId = null;
41
- /**
42
- * Send the message as an email.
43
- * You can't edit this after the message has been published.
44
- *
45
- * If false, when sending the message, it will switch to 'Sent' directly without adjusting the email_recipients directly.
46
- */
47
- sendAsEmail = true;
48
- /**
49
- * Show the message in the member portal
50
- *
51
- * Note: status should be 'Sent' for the message to be visible
52
- */
53
- showInMemberPortal = true;
54
- recipientFilter = structures_1.EmailRecipientFilter.create({});
55
- /**
56
- * Helper to prevent sending too many emails to the same person.
57
- * Allows for filtering on objects that didn't receive a specific email yet
58
- */
59
- emailType = null;
60
- subject;
61
- /** Raw json structure to edit the template */
62
- json = {};
63
- html = null;
64
- text = null;
65
- fromAddress = null;
66
- fromName = null;
67
- /**
68
- * Amount of recipients with an email address
69
- */
70
- emailRecipientsCount = null;
71
- /**
72
- * Amount of recipients without an email address
73
- */
74
- otherRecipientsCount = null;
75
- /**
76
- * Amount of recipients that have successfully received the email.
77
- */
78
- succeededCount = 0;
79
- /**
80
- * Amount of recipients that somehow failed to receive the email,
81
- * but with a soft error that doesn't require action.
82
- * - Duplicate email in recipient list
83
- * - Unsubscribed
84
- */
85
- softFailedCount = 0;
86
- /**
87
- * Amount of recipients that somehow failed to receive the email:
88
- * - Invalid email address
89
- * - Full email inbox
90
- */
91
- failedCount = 0;
92
- /**
93
- * Unique amount of members that are in the recipients list.
94
- */
95
- membersCount = 0;
96
- /**
97
- * Does only include bounces AFTER sending the email
98
- */
99
- hardBouncesCount = 0;
100
- /**
101
- * Does only include bounces AFTER sending the email
102
- */
103
- softBouncesCount = 0;
104
- /**
105
- * Does only include bounces AFTER sending the email
106
- */
107
- spamComplaintsCount = 0;
108
- status = structures_1.EmailStatus.Draft;
109
- recipientsStatus = structures_1.EmailRecipientsStatus.NotCreated;
110
- /**
111
- * Errors related to creating the recipients.
112
- */
113
- recipientsErrors = null;
114
- /**
115
- * Errors related to sending the email.
116
- */
117
- emailErrors = null;
118
- /**
119
- * todo: ignore automatically
120
- */
121
- attachments = [];
122
- sentAt = null;
123
- deletedAt = null;
124
- createdAt;
125
- updatedAt;
126
- static recipientLoaders = new Map();
127
- static pendingNotificationCountUpdates = new Map();
128
- throwIfNotReadyToSend() {
129
- if (this.subject == null || this.subject.length == 0) {
130
- throw new simple_errors_1.SimpleError({
131
- code: 'invalid_field',
132
- message: 'Missing subject',
133
- human: $t(`%wu`),
134
- });
135
- }
136
- if (this.text == null || this.text.length == 0) {
137
- throw new simple_errors_1.SimpleError({
138
- code: 'invalid_field',
139
- message: 'Missing text',
140
- human: $t(`%wv`),
141
- });
142
- }
143
- if (this.html == null || this.html.length == 0) {
144
- throw new simple_errors_1.SimpleError({
145
- code: 'invalid_field',
146
- message: 'Missing html',
147
- human: $t(`%wv`),
148
- });
149
- }
150
- if (this.fromAddress == null || this.fromAddress.length == 0) {
151
- throw new simple_errors_1.SimpleError({
152
- code: 'invalid_field',
153
- message: 'Missing from',
154
- human: $t(`%ww`),
155
- });
156
- }
157
- if (this.status === structures_1.EmailStatus.Draft && this.recipientsErrors !== null && this.recipientsStatus !== structures_1.EmailRecipientsStatus.Created) {
158
- throw new simple_errors_1.SimpleError({
159
- code: 'invalid_recipients',
160
- message: 'Failed to build recipients (count)',
161
- human: $t(`%1EE`) + ' ' + this.recipientsErrors.getHuman(),
162
- });
163
- }
164
- if (this.deletedAt) {
165
- throw new simple_errors_1.SimpleError({
166
- code: 'invalid_state',
167
- message: 'Email is deleted',
168
- human: $t(`%1EF`),
169
- });
170
- }
171
- this.validateAttachments();
172
- }
173
- throwIfNoUnsubscribeButton() {
174
- if (this.sendAsEmail === false) {
175
- return;
176
- }
177
- if (this.emailType) {
178
- // System email, no need for unsubscribe button
179
- return;
180
- }
181
- const replacement = '{{unsubscribeUrl}}';
182
- if (this.html) {
183
- // Check email contains an unsubscribe button
184
- if (!this.html.includes(replacement)) {
185
- throw new simple_errors_1.SimpleError({
186
- code: 'missing_unsubscribe_button',
187
- message: 'Missing unsubscribe button',
188
- human: $t(`%DS`),
189
- field: 'html',
190
- });
191
- }
192
- }
193
- if (this.text) {
194
- // Check email contains an unsubscribe button
195
- if (!this.text.includes(replacement)) {
196
- throw new simple_errors_1.SimpleError({
197
- code: 'missing_unsubscribe_button',
198
- message: 'Missing unsubscribe button',
199
- human: $t(`%DS`),
200
- field: 'text',
201
- });
202
- }
203
- }
204
- }
205
- validateAttachments() {
206
- // Validate attachments
207
- const size = this.attachments.reduce((value, attachment) => {
208
- return value + attachment.bytes;
209
- }, 0);
210
- if (size > 9.5 * 1024 * 1024) {
211
- throw new simple_errors_1.SimpleError({
212
- code: 'too_big_attachments',
213
- message: 'Too big attachments',
214
- human: $t(`%wx`),
215
- field: 'attachments',
216
- });
217
- }
218
- const safeContentTypes = [
219
- 'application/msword',
220
- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
221
- 'application/vnd.ms-excel',
222
- 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
223
- 'application/pdf',
224
- 'image/jpeg',
225
- 'image/png',
226
- 'image/gif',
227
- ];
228
- for (const attachment of this.attachments) {
229
- if (attachment.contentType && !safeContentTypes.includes(attachment.contentType)) {
230
- throw new simple_errors_1.SimpleError({
231
- code: 'content_type_not_supported',
232
- message: 'Content-Type not supported',
233
- human: $t(`%wy`),
234
- field: 'attachments',
235
- });
236
- }
237
- if (!attachment.content) {
238
- if (!attachment.file) {
239
- throw new simple_errors_1.SimpleError({
240
- code: 'invalid_attachment',
241
- message: 'Invalid attachment: missing file or content',
242
- field: 'attachments',
243
- });
244
- }
245
- if (!attachment.file.isPrivate) {
246
- throw new simple_errors_1.SimpleError({
247
- code: 'invalid_attachment',
248
- message: 'Invalid attachment: file must be private',
249
- field: 'attachments',
250
- });
251
- }
252
- if (!attachment.file.signature) {
253
- throw new simple_errors_1.SimpleError({
254
- code: 'invalid_attachment',
255
- message: 'Invalid attachment: file must be signed',
256
- field: 'attachments',
257
- });
258
- }
259
- }
260
- }
261
- }
262
- getFromAddress() {
263
- if (!this.fromName) {
264
- return {
265
- email: this.fromAddress,
266
- };
267
- }
268
- return {
269
- name: this.fromName,
270
- email: this.fromAddress,
271
- };
272
- }
273
- getDefaultFromAddress(organization) {
274
- const i18n = new backend_i18n_1.I18n($getLanguage(), $getCountry());
275
- let address = {
276
- email: 'noreply@' + i18n.localizedDomains.defaultBroadcastEmail(),
277
- };
278
- if (organization) {
279
- address = organization.getDefaultFrom(organization.i18n, 'broadcast');
280
- }
281
- if (!this.fromName) {
282
- return address;
283
- }
284
- return {
285
- name: this.fromName,
286
- email: address.email,
287
- };
288
- }
289
- async setFromTemplate(type) {
290
- // Most specific template: for specific group
291
- let templates = (await EmailTemplate_js_1.EmailTemplate.where({ type, organizationId: this.organizationId, groupId: null, webshopId: null }));
292
- // Then default
293
- if (templates.length === 0 && this.organizationId) {
294
- templates = (await EmailTemplate_js_1.EmailTemplate.where({ type, organizationId: null, groupId: null, webshopId: null }));
295
- }
296
- if (templates.length === 0) {
297
- // No default
298
- return false;
299
- }
300
- const defaultTemplate = templates[0];
301
- this.html = defaultTemplate.html;
302
- this.text = defaultTemplate.text;
303
- this.subject = defaultTemplate.subject;
304
- this.json = defaultTemplate.json;
305
- return true;
306
- }
307
- async lock(callback) {
308
- if (!this.id) {
309
- await this.save();
310
- }
311
- const id = this.id;
312
- return await queues_1.QueueHandler.schedule('lock-email-' + id, async (options) => {
313
- const upToDate = await Email.getByID(id);
314
- if (!upToDate) {
315
- throw new simple_errors_1.SimpleError({
316
- code: 'not_found',
317
- message: 'Email not found',
318
- human: $t(`%wz`),
319
- });
320
- }
321
- const c = await callback(upToDate, options);
322
- this.copyFrom(upToDate);
323
- return c;
324
- });
325
- }
326
- static async bumpNotificationCount(emailId, type) {
327
- // Send an update query
328
- const base = Email.update()
329
- .where('id', emailId);
330
- switch (type) {
331
- case 'hard-bounce': {
332
- base.set('hardBouncesCount', new sql_1.SQLCalculation(sql_1.SQL.column('hardBouncesCount'), new sql_1.SQLPlusSign(), (0, sql_1.readDynamicSQLExpression)(1)));
333
- break;
334
- }
335
- case 'soft-bounce': {
336
- base.set('softBouncesCount', new sql_1.SQLCalculation(sql_1.SQL.column('softBouncesCount'), new sql_1.SQLPlusSign(), (0, sql_1.readDynamicSQLExpression)(1)));
337
- break;
338
- }
339
- case 'complaint': {
340
- base.set('spamComplaintsCount', new sql_1.SQLCalculation(sql_1.SQL.column('spamComplaintsCount'), new sql_1.SQLPlusSign(), (0, sql_1.readDynamicSQLExpression)(1)));
341
- break;
342
- }
343
- }
344
- await base.update();
345
- await this.checkNeedsNotificationCountUpdate(emailId, true);
346
- }
347
- static async checkNeedsNotificationCountUpdate(emailId, didUpdate = false) {
348
- const existing = this.pendingNotificationCountUpdates.get(emailId);
349
- const object = existing ?? {
350
- timer: null,
351
- lastUpdate: didUpdate ? new Date() : null,
352
- };
353
- if (didUpdate) {
354
- object.lastUpdate = new Date();
355
- }
356
- if (existing) {
357
- this.pendingNotificationCountUpdates.set(emailId, object);
358
- }
359
- if (object.lastUpdate && object.lastUpdate < new Date(Date.now() - 5 * 60 * 1000)) {
360
- // After 5 minutes without notifications, run an update.
361
- await this.updateNotificationsCounts(emailId);
362
- // Stop here
363
- return;
364
- }
365
- // Schedule a slow update of all counts
366
- if (!object.timer) {
367
- object.timer = setTimeout(() => {
368
- object.timer = null;
369
- this.checkNeedsNotificationCountUpdate(emailId).catch(console.error);
370
- }, 1 * 60 * 1000);
371
- }
372
- }
373
- static async updateNotificationsCounts(emailId) {
374
- queues_1.QueueHandler.cancel('updateNotificationsCounts-' + emailId);
375
- return await queues_1.QueueHandler.schedule('updateNotificationsCounts-' + emailId, async () => {
376
- const query = sql_1.SQL.select(new sql_1.SQLSelectAs(new sql_1.SQLCount(sql_1.SQL.column('hardBounceError')), new sql_1.SQLAlias('data__hardBounces')),
377
- // If the current amount_due is negative, we can ignore that negative part if there is a future due item
378
- new sql_1.SQLSelectAs(new sql_1.SQLCount(sql_1.SQL.column('softBounceError')), new sql_1.SQLAlias('data__softBounces')), new sql_1.SQLSelectAs(new sql_1.SQLCount(sql_1.SQL.column('spamComplaintError')), new sql_1.SQLAlias('data__complaints')))
379
- .from(EmailRecipient_js_1.EmailRecipient.table)
380
- .where('emailId', emailId);
381
- const result = await query.fetch();
382
- if (result.length !== 1) {
383
- console.error('Unexpected result', result);
384
- return;
385
- }
386
- const row = result[0]['data'];
387
- if (!row) {
388
- console.error('Unexpected result row', result);
389
- return;
390
- }
391
- const hardBounces = row['hardBounces'];
392
- const softBounces = row['softBounces'];
393
- const complaints = row['complaints'];
394
- if (typeof hardBounces !== 'number' || typeof softBounces !== 'number' || typeof complaints !== 'number') {
395
- console.error('Unexpected result values', row);
396
- return;
397
- }
398
- console.log('Updating email notification counts', emailId, hardBounces, softBounces, complaints);
399
- // Send an update query
400
- await Email.update()
401
- .where('id', emailId)
402
- .set('hardBouncesCount', hardBounces)
403
- .set('softBouncesCount', softBounces)
404
- .set('spamComplaintsCount', complaints)
405
- .update();
406
- });
407
- }
408
- async queueForSending(waitForSending = false) {
409
- console.log('Queueing email for sending', this.id);
410
- this.throwIfNotReadyToSend();
411
- this.throwIfNoUnsubscribeButton();
412
- await this.lock(async (upToDate) => {
413
- if (upToDate.status === structures_1.EmailStatus.Draft) {
414
- upToDate.status = structures_1.EmailStatus.Queued;
415
- }
416
- if (upToDate.status === structures_1.EmailStatus.Failed) {
417
- // Retry failed email
418
- upToDate.status = structures_1.EmailStatus.Queued;
419
- }
420
- await upToDate.save();
421
- });
422
- if (waitForSending) {
423
- return await this.resumeSending();
424
- }
425
- else {
426
- this.resumeSending().catch(console.error);
427
- }
428
- return this;
429
- }
430
- async loadAttachments() {
431
- const attachments = [];
432
- for (const attachment of this.attachments) {
433
- if (!attachment.content && !attachment.file) {
434
- console.warn('Attachment without content found, skipping', attachment);
435
- continue;
436
- }
437
- let filename = $t('%180');
438
- if (attachment.contentType === 'application/pdf') {
439
- // tmp solution for pdf only
440
- filename += '.pdf';
441
- }
442
- if (attachment.file?.name) {
443
- filename = attachment.file.name.toLowerCase().replace(/[^a-z0-9.]+/g, '-').replace(/^-+/, '').replace(/-+$/, '');
444
- }
445
- // Correct file name if needed
446
- if (attachment.filename) {
447
- filename = attachment.filename.toLowerCase().replace(/[^a-z0-9.]+/g, '-').replace(/^-+/, '').replace(/-+$/, '');
448
- }
449
- if (attachment.content) {
450
- attachments.push({
451
- filename: filename,
452
- content: attachment.content,
453
- contentType: attachment.contentType ?? undefined,
454
- encoding: 'base64',
455
- });
456
- }
457
- else {
458
- // Note: because we send lots of emails, we better download the file here so we can reuse it in every email instead of downloading it every time
459
- const withSigned = await attachment.file.withSignedUrl();
460
- if (!withSigned || !withSigned.signedUrl) {
461
- throw new simple_errors_1.SimpleError({
462
- code: 'attachment_not_found',
463
- message: 'Attachment not found',
464
- human: $t(`%181`),
465
- });
466
- }
467
- const filePath = withSigned.signedUrl;
468
- let fileBuffer = null;
469
- try {
470
- const response = await fetch(filePath);
471
- fileBuffer = Buffer.from(await response.arrayBuffer());
472
- }
473
- catch (e) {
474
- throw new simple_errors_1.SimpleError({
475
- code: 'attachment_not_found',
476
- message: 'Attachment not found',
477
- human: $t(`%181`),
478
- });
479
- }
480
- attachments.push({
481
- filename: filename,
482
- contentType: attachment.contentType ?? undefined,
483
- content: fileBuffer,
484
- });
485
- }
486
- }
487
- return attachments;
488
- }
489
- async sendSingleRecipient(recipient, organization, data) {
490
- let promiseResolve;
491
- const promise = new Promise((resolve) => {
492
- promiseResolve = resolve;
493
- });
494
- const virtualRecipient = recipient.getRecipient();
495
- let resolved = false;
496
- const callback = async (error) => {
497
- if (resolved) {
498
- return;
499
- }
500
- resolved = true;
501
- try {
502
- if (error === null) {
503
- // Mark saved
504
- recipient.sentAt = new Date();
505
- recipient.failErrorMessage = null;
506
- if (recipient.failError) {
507
- recipient.previousFailError = recipient.failError;
508
- }
509
- recipient.failError = null;
510
- // Update repacements that have been generated
511
- recipient.replacements = virtualRecipient.replacements;
512
- await recipient.save();
513
- }
514
- else {
515
- recipient.failCount += 1;
516
- recipient.failErrorMessage = error.message;
517
- if (recipient.failError) {
518
- recipient.previousFailError = recipient.failError;
519
- }
520
- recipient.failError = errorToSimpleErrors(error);
521
- recipient.firstFailedAt = recipient.firstFailedAt ?? new Date();
522
- recipient.lastFailedAt = new Date();
523
- await recipient.save();
524
- }
525
- }
526
- catch (e) {
527
- console.error(e);
528
- }
529
- promiseResolve();
530
- };
531
- // Do send the email
532
- // Create e-mail builder
533
- const builder = await (0, EmailBuilder_js_1.getEmailBuilder)(organization ?? null, {
534
- recipients: [
535
- virtualRecipient,
536
- ],
537
- from: data.from,
538
- replyTo: data.replyTo,
539
- subject: this.subject,
540
- html: this.html,
541
- type: this.emailType ? 'transactional' : 'broadcast',
542
- attachments: data.attachments,
543
- callback(error) {
544
- callback(error).catch(console.error);
545
- },
546
- headers: {
547
- 'X-Email-Id': this.id,
548
- 'X-Email-Recipient-Id': recipient.id,
549
- },
550
- });
551
- email_1.Email.schedule(builder);
552
- return await promise;
553
- }
554
- async resumeSending(singleRecipientId = null) {
555
- const id = this.id;
556
- return await queues_1.QueueHandler.schedule('send-email', async ({ abort }) => {
557
- return await this.lock(async function (upToDate) {
558
- if (upToDate.status === structures_1.EmailStatus.Sent) {
559
- // Already done
560
- // In other cases -> queue has stopped and we can retry
561
- if (!singleRecipientId) {
562
- console.log('Email already sent, skipping...', upToDate.id);
563
- return upToDate;
564
- }
565
- }
566
- else {
567
- if (singleRecipientId) {
568
- // Not possible
569
- throw new simple_errors_1.SimpleError({
570
- code: 'invalid_state',
571
- message: 'Cannot retry single recipient for email that is not yet sent',
572
- });
573
- }
574
- if (upToDate.status === structures_1.EmailStatus.Sending) {
575
- // This is an automatic retry.
576
- if (upToDate.emailType) {
577
- // Not eligible for retry
578
- upToDate.status = structures_1.EmailStatus.Failed;
579
- await upToDate.save();
580
- return upToDate;
581
- }
582
- if (upToDate.createdAt < new Date(new Date().getTime() - 1000 * 60 * 60 * 24 * 2)) {
583
- // Too long
584
- console.error('Email has been sending for too long. Marking as failed...', upToDate.id);
585
- upToDate.status = structures_1.EmailStatus.Failed;
586
- await upToDate.save();
587
- return upToDate;
588
- }
589
- }
590
- else if (upToDate.status !== structures_1.EmailStatus.Queued) {
591
- console.error('Email is not queued or sending, cannot send', upToDate.id, upToDate.status);
592
- return upToDate;
593
- }
594
- }
595
- const organization = upToDate.organizationId ? await Organization_js_1.Organization.getByID(upToDate.organizationId) : null;
596
- let from = upToDate.getDefaultFromAddress(organization);
597
- let replyTo = upToDate.getFromAddress();
598
- let succeededCount = 0;
599
- let softFailedCount = 0;
600
- let failedCount = 0;
601
- try {
602
- upToDate.throwIfNotReadyToSend();
603
- upToDate.throwIfNoUnsubscribeButton();
604
- if (!from) {
605
- throw new simple_errors_1.SimpleError({
606
- code: 'invalid_field',
607
- message: 'Missing from',
608
- human: $t(`%ww`),
609
- });
610
- }
611
- // Can we send from this e-mail or reply-to?
612
- if (upToDate.fromAddress && await (0, EmailBuilder_js_1.canSendFromEmail)(upToDate.fromAddress, organization ?? null)) {
613
- from = upToDate.getFromAddress();
614
- replyTo = null;
615
- }
616
- abort.throwIfAborted();
617
- if (!singleRecipientId) {
618
- upToDate.status = structures_1.EmailStatus.Sending;
619
- }
620
- upToDate.sentAt = upToDate.sentAt ?? new Date();
621
- await upToDate.save();
622
- // Create recipients if not yet created
623
- await upToDate.buildRecipients();
624
- abort.throwIfAborted();
625
- // Refresh model
626
- const c = (await Email.getByID(id));
627
- if (!c) {
628
- throw new simple_errors_1.SimpleError({
629
- code: 'not_found',
630
- message: 'Email not found',
631
- human: $t(`%wz`),
632
- });
633
- }
634
- upToDate.copyFrom(c);
635
- if (upToDate.recipientsStatus !== structures_1.EmailRecipientsStatus.Created) {
636
- throw new simple_errors_1.SimpleError({
637
- code: 'recipients_not_created',
638
- message: 'Failed to create recipients',
639
- human: $t(`%x0`),
640
- });
641
- }
642
- // Create a buffer of all attachments
643
- if (upToDate.sendAsEmail === true) {
644
- const attachments = await upToDate.loadAttachments();
645
- // Start actually sending in batches of recipients that are not yet sent
646
- let idPointer = '';
647
- const batchSize = 100;
648
- let isSavingStatus = false;
649
- let lastStatusSave = new Date();
650
- async function saveStatus() {
651
- if (singleRecipientId) {
652
- // Don't save during looping
653
- return;
654
- }
655
- if (!upToDate) {
656
- return;
657
- }
658
- if (isSavingStatus) {
659
- return;
660
- }
661
- if ((new Date().getTime() - lastStatusSave.getTime()) < 1000 * 5) {
662
- // Save at most every 5 seconds
663
- return;
664
- }
665
- if (succeededCount < upToDate.succeededCount || softFailedCount < upToDate.softFailedCount || failedCount < upToDate.failedCount) {
666
- // Do not update on retries
667
- return;
668
- }
669
- lastStatusSave = new Date();
670
- isSavingStatus = true;
671
- upToDate.succeededCount = succeededCount;
672
- upToDate.softFailedCount = softFailedCount;
673
- upToDate.failedCount = failedCount;
674
- try {
675
- await upToDate.save();
676
- }
677
- finally {
678
- isSavingStatus = false;
679
- }
680
- }
681
- while (true) {
682
- abort.throwIfAborted();
683
- const data = await sql_1.SQL.select()
684
- .from('email_recipients')
685
- .where('emailId', upToDate.id)
686
- .where('id', sql_1.SQLWhereSign.Greater, idPointer)
687
- .orderBy(sql_1.SQL.column('id'), 'ASC')
688
- .limit(batchSize)
689
- .fetch();
690
- const recipients = EmailRecipient_js_1.EmailRecipient.fromRows(data, 'email_recipients');
691
- if (recipients.length === 0) {
692
- break;
693
- }
694
- const sendingPromises = [];
695
- let skipped = 0;
696
- for (const recipient of recipients) {
697
- idPointer = recipient.id;
698
- if (recipient.sentAt) {
699
- succeededCount += 1;
700
- await saveStatus();
701
- skipped++;
702
- continue;
703
- }
704
- if (!recipient.email) {
705
- skipped++;
706
- continue;
707
- }
708
- if (recipient.duplicateOfRecipientId) {
709
- skipped++;
710
- continue;
711
- }
712
- if (singleRecipientId) {
713
- if (recipient.id !== singleRecipientId) {
714
- // Failed or soft-failed
715
- if (recipient.failError && (0, structures_1.isSoftEmailRecipientError)(recipient.failError)) {
716
- softFailedCount += 1;
717
- }
718
- else {
719
- failedCount += 1;
720
- }
721
- skipped++;
722
- await saveStatus();
723
- continue;
724
- }
725
- }
726
- const promise = upToDate.sendSingleRecipient(recipient, organization ?? null, {
727
- from,
728
- replyTo,
729
- attachments,
730
- });
731
- sendingPromises.push(promise.then(async () => {
732
- if (recipient.sentAt) {
733
- succeededCount += 1;
734
- await saveStatus();
735
- }
736
- else {
737
- // Failed or soft-failed
738
- if (recipient.failError && (0, structures_1.isSoftEmailRecipientError)(recipient.failError)) {
739
- softFailedCount += 1;
740
- }
741
- else {
742
- failedCount += 1;
743
- }
744
- await saveStatus();
745
- }
746
- }));
747
- }
748
- if (sendingPromises.length > 0 || skipped > 0) {
749
- await Promise.all(sendingPromises);
750
- }
751
- else {
752
- break;
753
- }
754
- }
755
- }
756
- }
757
- catch (e) {
758
- if (!upToDate) {
759
- throw e;
760
- }
761
- if (!singleRecipientId) {
762
- upToDate.succeededCount = succeededCount;
763
- upToDate.softFailedCount = softFailedCount;
764
- upToDate.failedCount = failedCount;
765
- if ((0, queues_1.isAbortedError)(e) || (((0, simple_errors_1.isSimpleError)(e) || (0, simple_errors_1.isSimpleErrors)(e)) && e.hasCode('SHUTDOWN'))) {
766
- // Keep sending status: we'll resume after the reboot
767
- await upToDate.save();
768
- throw e;
769
- }
770
- upToDate.emailErrors = errorToSimpleErrors(e);
771
- upToDate.status = structures_1.EmailStatus.Failed;
772
- await upToDate.save();
773
- }
774
- throw e;
775
- }
776
- if (!singleRecipientId) {
777
- if (upToDate.sendAsEmail && upToDate.emailRecipientsCount === 0 && upToDate.userId === null) {
778
- // We only delete automated emails (email type) if they have no recipients
779
- console.log('No recipients found for email ', upToDate.id, ' deleting...');
780
- await upToDate.delete();
781
- return null;
782
- }
783
- console.log('Finished sending email', upToDate.id);
784
- // Mark email as sent
785
- if (upToDate.sendAsEmail && !upToDate.showInMemberPortal && (succeededCount + failedCount + softFailedCount) === 0) {
786
- upToDate.status = structures_1.EmailStatus.Failed;
787
- upToDate.emailErrors = new simple_errors_1.SimpleErrors(new simple_errors_1.SimpleError({
788
- code: 'no_recipients',
789
- message: 'No recipients',
790
- human: $t(`%1EG`),
791
- }));
792
- }
793
- else {
794
- upToDate.status = structures_1.EmailStatus.Sent;
795
- upToDate.emailErrors = null;
796
- }
797
- }
798
- upToDate.succeededCount = succeededCount;
799
- upToDate.softFailedCount = softFailedCount;
800
- upToDate.failedCount = failedCount;
801
- await upToDate.save();
802
- return upToDate;
803
- });
804
- });
805
- }
806
- async updateCount() {
807
- // First reset
808
- const id = this.id;
809
- await queues_1.QueueHandler.schedule('email-count-' + this.id, async function () {
810
- const upToDate = await Email.getByID(id);
811
- if (!upToDate || upToDate.sentAt || !upToDate.id || upToDate.status !== structures_1.EmailStatus.Draft) {
812
- return;
813
- }
814
- if (upToDate.recipientsStatus === structures_1.EmailRecipientsStatus.Created) {
815
- return;
816
- }
817
- upToDate.emailRecipientsCount = null;
818
- upToDate.recipientsErrors = null;
819
- await upToDate.save();
820
- });
821
- await this.refresh();
822
- queues_1.QueueHandler.abort('email-count-' + this.id);
823
- queues_1.QueueHandler.schedule('email-count-' + this.id, async function ({ abort }) {
824
- let upToDate = await Email.getByID(id);
825
- if (!upToDate || upToDate.sentAt || !upToDate.id || upToDate.status !== structures_1.EmailStatus.Draft) {
826
- return;
827
- }
828
- if (upToDate.recipientsStatus === structures_1.EmailRecipientsStatus.Created) {
829
- return;
830
- }
831
- let count = 0;
832
- console.log('Updating recipient count for email', id);
833
- try {
834
- for (const subfilter of upToDate.recipientFilter.filters) {
835
- // Create recipients
836
- const loader = Email.recipientLoaders.get(subfilter.type);
837
- if (!loader) {
838
- throw new Error('Loader for type ' + subfilter.type + ' has not been initialised on the Email model');
839
- }
840
- const request = new structures_1.LimitedFilteredRequest({
841
- filter: subfilter.filter,
842
- sort: [{ key: 'id', order: structures_1.SortItemDirection.ASC }],
843
- limit: 1,
844
- search: subfilter.search,
845
- });
846
- abort.throwIfAborted();
847
- const c = await loader.count(request, subfilter.subfilter);
848
- count += c;
849
- }
850
- abort.throwIfAborted();
851
- // Check if we have a more reliable emailRecipientsCount in the meantime
852
- upToDate = await Email.getByID(id);
853
- if (!upToDate) {
854
- return;
855
- }
856
- if (upToDate.recipientsStatus === structures_1.EmailRecipientsStatus.Created) {
857
- console.log('Canceled recipient count update for email', id, 'already created recipients');
858
- return;
859
- }
860
- upToDate.emailRecipientsCount = count;
861
- upToDate.recipientsErrors = null;
862
- await upToDate.save();
863
- console.log('Updated recipient count for email', id, 'to', count);
864
- }
865
- catch (e) {
866
- if ((0, queues_1.isAbortedError)(e)) {
867
- return;
868
- }
869
- console.error('Failed to update count for email', id);
870
- console.error(e);
871
- // Check if we have a more reliable emailRecipientsCount in the meantime
872
- upToDate = await Email.getByID(id);
873
- if (!upToDate) {
874
- return;
875
- }
876
- if (upToDate.recipientsStatus === structures_1.EmailRecipientsStatus.Created) {
877
- return;
878
- }
879
- upToDate.recipientsErrors = errorToSimpleErrors(e);
880
- upToDate.emailRecipientsCount = null;
881
- await upToDate.save();
882
- }
883
- }).catch(console.error);
884
- }
885
- async buildRecipients() {
886
- const id = this.id;
887
- await queues_1.QueueHandler.schedule('email-build-recipients-' + this.id, async function ({ abort }) {
888
- const upToDate = await Email.getByID(id);
889
- if (!upToDate || !upToDate.id) {
890
- return;
891
- }
892
- if (upToDate.recipientsStatus === structures_1.EmailRecipientsStatus.Created) {
893
- return;
894
- }
895
- if (upToDate.status === structures_1.EmailStatus.Sent) {
896
- return;
897
- }
898
- abort.throwIfAborted();
899
- const organization = upToDate.organizationId ? (await Organization_js_1.Organization.getByID(upToDate.organizationId) ?? null) : null;
900
- if (upToDate.organizationId && !organization) {
901
- throw new simple_errors_1.SimpleError({
902
- code: 'organization_not_found',
903
- message: 'Organization not found',
904
- human: $t(`%1NV`),
905
- });
906
- }
907
- const platform = await Platform_js_1.Platform.getSharedPrivateStruct();
908
- console.log('Building recipients for email', id);
909
- // If it is already creating -> something went wrong (e.g. server restart) and we can safely try again
910
- upToDate.recipientsStatus = structures_1.EmailRecipientsStatus.Creating;
911
- await upToDate.save();
912
- const membersSet = new Set();
913
- const emailsSet = new Set();
914
- let count = 0;
915
- let countWithoutEmail = 0;
916
- try {
917
- // Delete all recipients
918
- await sql_1.SQL
919
- .delete()
920
- .from(sql_1.SQL.table('email_recipients'))
921
- .where(sql_1.SQL.column('emailId'), upToDate.id);
922
- abort.throwIfAborted();
923
- for (const subfilter of upToDate.recipientFilter.filters) {
924
- // Create recipients
925
- const loader = Email.recipientLoaders.get(subfilter.type);
926
- if (!loader) {
927
- throw new Error('Loader for type ' + subfilter.type + ' has not been initialised on the Email model');
928
- }
929
- let request = new structures_1.LimitedFilteredRequest({
930
- filter: subfilter.filter,
931
- sort: [{ key: 'id', order: structures_1.SortItemDirection.ASC }],
932
- limit: 100,
933
- search: subfilter.search,
934
- });
935
- const beforeFetchAllResult = loader.beforeFetchAll ? await loader.beforeFetchAll(request, subfilter.subfilter) : undefined;
936
- while (request) {
937
- abort.throwIfAborted();
938
- const response = await loader.fetch(request, subfilter.subfilter, beforeFetchAllResult);
939
- for (const item of response.results) {
940
- if (!item.email && !item.memberId && !item.userId) {
941
- continue;
942
- }
943
- const recipient = new EmailRecipient_js_1.EmailRecipient();
944
- recipient.emailType = upToDate.emailType;
945
- recipient.objectId = item.objectId;
946
- recipient.emailId = upToDate.id;
947
- recipient.email = item.email;
948
- recipient.firstName = item.firstName;
949
- recipient.lastName = item.lastName;
950
- recipient.replacements = item.replacements;
951
- recipient.memberId = item.memberId ?? null;
952
- recipient.userId = item.userId ?? null;
953
- recipient.organizationId = upToDate.organizationId ?? null;
954
- await (0, EmailBuilder_js_1.fillRecipientReplacements)(recipient, {
955
- platform,
956
- organization,
957
- from: upToDate.getFromAddress(),
958
- replyTo: null,
959
- forPreview: false,
960
- });
961
- recipient.replacements = (0, EmailBuilder_js_1.removeUnusedReplacements)(upToDate.html ?? '', recipient.replacements);
962
- let duplicateOfRecipientId = null;
963
- if (item.email && emailsSet.has(item.email)) {
964
- console.log('Found duplicate email recipient', item.email);
965
- // Try to merge
966
- const existing = await EmailRecipient_js_1.EmailRecipient.select()
967
- .where('emailId', upToDate.id)
968
- .where('email', item.email)
969
- .where('duplicateOfRecipientId', null)
970
- .fetch();
971
- for (const other of existing) {
972
- const merged = (0, EmailBuilder_js_1.mergeReplacementsIfEqual)(other.replacements, recipient.replacements);
973
- if (merged !== false) {
974
- console.log('Found mergeable duplicate email recipient', item.email, other.id);
975
- duplicateOfRecipientId = other.id;
976
- other.replacements = merged;
977
- other.firstName = other.firstName || item.firstName;
978
- other.lastName = other.lastName || item.lastName;
979
- await other.save();
980
- recipient.replacements = merged;
981
- break;
982
- }
983
- else {
984
- console.log('Could not merge duplicate email recipient', item.email, other.id, 'keeping both', other.replacements, item.replacements);
985
- }
986
- }
987
- }
988
- recipient.duplicateOfRecipientId = duplicateOfRecipientId;
989
- await recipient.save();
990
- if (recipient.memberId) {
991
- membersSet.add(recipient.memberId);
992
- }
993
- if (recipient.email) {
994
- emailsSet.add(recipient.email);
995
- }
996
- if (!recipient.email || duplicateOfRecipientId) {
997
- countWithoutEmail += 1;
998
- }
999
- else {
1000
- count += 1;
1001
- }
1002
- }
1003
- request = response.next ?? null;
1004
- }
1005
- }
1006
- upToDate.recipientsStatus = structures_1.EmailRecipientsStatus.Created;
1007
- upToDate.emailRecipientsCount = count;
1008
- upToDate.otherRecipientsCount = countWithoutEmail;
1009
- upToDate.recipientsErrors = null;
1010
- upToDate.membersCount = membersSet.size;
1011
- await upToDate.save();
1012
- }
1013
- catch (e) {
1014
- console.error('Failed to build recipients for email', id);
1015
- console.error(e);
1016
- upToDate.recipientsStatus = structures_1.EmailRecipientsStatus.NotCreated;
1017
- upToDate.recipientsErrors = errorToSimpleErrors(e);
1018
- await upToDate.save();
1019
- }
1020
- });
1021
- }
1022
- async buildExampleRecipient(isNewlyCreated = false) {
1023
- const id = this.id;
1024
- await queues_1.QueueHandler.schedule('email-build-recipients-' + this.id, async function () {
1025
- const upToDate = await Email.getByID(id);
1026
- if (!upToDate || upToDate.sentAt || !upToDate.id) {
1027
- return;
1028
- }
1029
- if (upToDate.recipientsStatus !== structures_1.EmailRecipientsStatus.NotCreated) {
1030
- return;
1031
- }
1032
- try {
1033
- // Delete all recipients
1034
- if (!isNewlyCreated) {
1035
- await sql_1.SQL
1036
- .delete()
1037
- .from(sql_1.SQL.table('email_recipients'))
1038
- .where(sql_1.SQL.column('emailId'), upToDate.id);
1039
- }
1040
- for (const subfilter of upToDate.recipientFilter.filters) {
1041
- // Create recipients
1042
- const loader = Email.recipientLoaders.get(subfilter.type);
1043
- if (!loader) {
1044
- throw new Error('Loader for type ' + subfilter.type + ' has not been initialised on the Email model');
1045
- }
1046
- let request = new structures_1.LimitedFilteredRequest({
1047
- filter: subfilter.filter,
1048
- sort: [{ key: 'id', order: structures_1.SortItemDirection.ASC }],
1049
- limit: 10,
1050
- search: subfilter.search,
1051
- });
1052
- const beforeFetchAllResult = loader.beforeFetchAll ? await loader.beforeFetchAll(request, subfilter.subfilter) : undefined;
1053
- while (request) {
1054
- const response = await loader.fetch(request, subfilter.subfilter, beforeFetchAllResult);
1055
- // Note: it is possible that a result in the database doesn't return a recipient (in memory filtering)
1056
- // so we do need pagination
1057
- for (const item of response.results) {
1058
- const recipient = new EmailRecipient_js_1.EmailRecipient();
1059
- recipient.emailType = upToDate.emailType;
1060
- recipient.emailId = upToDate.id;
1061
- recipient.objectId = item.objectId;
1062
- recipient.email = item.email;
1063
- recipient.firstName = item.firstName;
1064
- recipient.lastName = item.lastName;
1065
- recipient.replacements = item.replacements;
1066
- recipient.memberId = item.memberId ?? null;
1067
- recipient.userId = item.userId ?? null;
1068
- recipient.organizationId = upToDate.organizationId ?? null;
1069
- await recipient.save();
1070
- if (recipient.email || recipient.userId) {
1071
- return;
1072
- }
1073
- }
1074
- request = null;
1075
- }
1076
- }
1077
- console.warn('No example recipient found for email', id);
1078
- }
1079
- catch (e) {
1080
- console.error('Failed to build example recipient for email', id);
1081
- console.error(e);
1082
- }
1083
- });
1084
- }
1085
- getStructure() {
1086
- return structures_1.Email.create(this);
1087
- }
1088
- async getPreviewStructure() {
1089
- const emailRecipient = await EmailRecipient_js_1.EmailRecipient.select()
1090
- .where('emailId', this.id)
1091
- .where('email', '!=', null)
1092
- .first(false);
1093
- let recipientRow;
1094
- if (emailRecipient) {
1095
- recipientRow = await emailRecipient.getStructure();
1096
- }
1097
- if (!recipientRow) {
1098
- recipientRow = (0, structures_1.getExampleRecipient)();
1099
- }
1100
- const virtualRecipient = recipientRow.getRecipient();
1101
- const organization = this.organizationId ? (await Organization_js_1.Organization.getByID(this.organizationId)) : null;
1102
- await (0, EmailBuilder_js_1.fillRecipientReplacements)(virtualRecipient, {
1103
- organization,
1104
- from: this.getFromAddress(),
1105
- replyTo: null,
1106
- forPreview: true,
1107
- forceRefresh: !this.sentAt,
1108
- });
1109
- recipientRow.replacements = virtualRecipient.replacements;
1110
- let user = null;
1111
- if (this.userId) {
1112
- const u = await User_js_1.User.getByID(this.userId);
1113
- if (u) {
1114
- user = u.getStructure();
1115
- }
1116
- }
1117
- let organizationStruct = null;
1118
- if (organization) {
1119
- organizationStruct = organization.getBaseStructure();
1120
- }
1121
- return structures_1.EmailPreview.create({
1122
- ...this,
1123
- user,
1124
- organization: organizationStruct,
1125
- exampleRecipient: recipientRow,
1126
- });
1127
- }
1128
- async getStructureForUser(user, memberIds) {
1129
- const emailRecipients = await EmailRecipient_js_1.EmailRecipient.select()
1130
- .where('emailId', this.id)
1131
- .where('memberId', memberIds)
1132
- .fetch();
1133
- const organization = this.organizationId ? (await Organization_js_1.Organization.getByID(this.organizationId)) : null;
1134
- const recipientsMap = new Map();
1135
- for (const memberId of memberIds) {
1136
- const preferred = emailRecipients.find(e => e.memberId === memberId && (e.userId === user.id || e.email === user.email));
1137
- if (preferred) {
1138
- recipientsMap.set(preferred.duplicateOfRecipientId ?? preferred.id, preferred);
1139
- continue;
1140
- }
1141
- const byMember = emailRecipients.find(e => e.memberId === memberId && e.userId === null && e.email === null);
1142
- if (byMember) {
1143
- recipientsMap.set(byMember.duplicateOfRecipientId ?? byMember.id, byMember);
1144
- continue;
1145
- }
1146
- const anyData = emailRecipients.find(e => e.memberId === memberId);
1147
- if (anyData) {
1148
- recipientsMap.set(anyData.duplicateOfRecipientId ?? anyData.id, anyData);
1149
- continue;
1150
- }
1151
- }
1152
- // Remove duplicates that are marked as the same recipient
1153
- const cleanedRecipients = [...recipientsMap.values()];
1154
- const structures = await EmailRecipient_js_1.EmailRecipient.getStructures(cleanedRecipients);
1155
- for (const struct of structures) {
1156
- if (!(struct.userId === user.id || struct.email === user.email) && !((struct.userId === null && struct.email === null))) {
1157
- (0, EmailBuilder_js_1.stripSensitiveRecipientReplacements)(struct, {
1158
- organization,
1159
- willFill: true,
1160
- });
1161
- }
1162
- struct.firstName = user.firstName;
1163
- struct.lastName = user.lastName;
1164
- struct.email = user.email;
1165
- struct.userId = user.id;
1166
- // We always refresh the data when we display it on the web (so everything is up to date)
1167
- await (0, EmailBuilder_js_1.fillRecipientReplacements)(struct, {
1168
- organization,
1169
- from: this.getFromAddress(),
1170
- replyTo: null,
1171
- forPreview: false,
1172
- forceRefresh: true,
1173
- });
1174
- (0, EmailBuilder_js_1.stripRecipientReplacementsForWebDisplay)(struct, {
1175
- organization,
1176
- });
1177
- if (this.html) {
1178
- struct.replacements = (0, EmailBuilder_js_1.removeUnusedReplacements)(this.html, struct.replacements);
1179
- }
1180
- }
1181
- // Loop structures and remove if they have exactly the same content
1182
- // We do this here, because it is possible the user didn't receive any emails, so
1183
- // the merging at time of sending the emails didn't happen (uniqueness happened on email)
1184
- const uniqueStructures = [];
1185
- for (const struct of structures) {
1186
- let found = false;
1187
- for (const unique of uniqueStructures) {
1188
- const merged = (0, EmailBuilder_js_1.mergeReplacementsIfEqual)(unique.replacements, struct.replacements);
1189
- if (merged !== false) {
1190
- unique.replacements = merged;
1191
- found = true;
1192
- break;
1193
- }
1194
- }
1195
- if (!found) {
1196
- uniqueStructures.push(struct);
1197
- }
1198
- }
1199
- let organizationStruct = null;
1200
- if (organization) {
1201
- organizationStruct = organization.getBaseStructure();
1202
- }
1203
- return structures_1.EmailWithRecipients.create({
1204
- ...this,
1205
- organization: organizationStruct,
1206
- recipients: uniqueStructures,
1207
- // Remove private-like data
1208
- softBouncesCount: 0,
1209
- failedCount: 0,
1210
- emailErrors: null,
1211
- recipientsErrors: null,
1212
- succeededCount: 1,
1213
- emailRecipientsCount: 1,
1214
- hardBouncesCount: 0,
1215
- spamComplaintsCount: 0,
1216
- recipientFilter: structures_1.EmailRecipientFilter.create({}),
1217
- membersCount: 1,
1218
- otherRecipientsCount: 0,
1219
- });
1220
- }
1221
- }
1222
- exports.Email = Email;
1223
- tslib_1.__decorate([
1224
- (0, simple_database_1.column)({
1225
- primary: true, type: 'string', beforeSave(value) {
1226
- return value ?? (0, uuid_1.v4)();
1227
- },
1228
- })
1229
- ], Email.prototype, "id", void 0);
1230
- tslib_1.__decorate([
1231
- (0, simple_database_1.column)({ type: 'string', nullable: true })
1232
- ], Email.prototype, "organizationId", void 0);
1233
- tslib_1.__decorate([
1234
- (0, simple_database_1.column)({ type: 'string', nullable: true })
1235
- ], Email.prototype, "senderId", void 0);
1236
- tslib_1.__decorate([
1237
- (0, simple_database_1.column)({ type: 'string', nullable: true })
1238
- ], Email.prototype, "userId", void 0);
1239
- tslib_1.__decorate([
1240
- (0, simple_database_1.column)({ type: 'boolean' })
1241
- ], Email.prototype, "sendAsEmail", void 0);
1242
- tslib_1.__decorate([
1243
- (0, simple_database_1.column)({ type: 'boolean' })
1244
- ], Email.prototype, "showInMemberPortal", void 0);
1245
- tslib_1.__decorate([
1246
- (0, simple_database_1.column)({ type: 'json', decoder: structures_1.EmailRecipientFilter })
1247
- ], Email.prototype, "recipientFilter", void 0);
1248
- tslib_1.__decorate([
1249
- (0, simple_database_1.column)({ type: 'string', nullable: true })
1250
- ], Email.prototype, "emailType", void 0);
1251
- tslib_1.__decorate([
1252
- (0, simple_database_1.column)({ type: 'string', nullable: true })
1253
- ], Email.prototype, "subject", void 0);
1254
- tslib_1.__decorate([
1255
- (0, simple_database_1.column)({ type: 'json', decoder: simple_encoding_1.AnyDecoder })
1256
- ], Email.prototype, "json", void 0);
1257
- tslib_1.__decorate([
1258
- (0, simple_database_1.column)({ type: 'string', nullable: true })
1259
- ], Email.prototype, "html", void 0);
1260
- tslib_1.__decorate([
1261
- (0, simple_database_1.column)({ type: 'string', nullable: true })
1262
- ], Email.prototype, "text", void 0);
1263
- tslib_1.__decorate([
1264
- (0, simple_database_1.column)({ type: 'string', nullable: true })
1265
- ], Email.prototype, "fromAddress", void 0);
1266
- tslib_1.__decorate([
1267
- (0, simple_database_1.column)({ type: 'string', nullable: true })
1268
- ], Email.prototype, "fromName", void 0);
1269
- tslib_1.__decorate([
1270
- (0, simple_database_1.column)({ type: 'integer', nullable: true })
1271
- ], Email.prototype, "emailRecipientsCount", void 0);
1272
- tslib_1.__decorate([
1273
- (0, simple_database_1.column)({ type: 'integer', nullable: true })
1274
- ], Email.prototype, "otherRecipientsCount", void 0);
1275
- tslib_1.__decorate([
1276
- (0, simple_database_1.column)({ type: 'integer' })
1277
- ], Email.prototype, "succeededCount", void 0);
1278
- tslib_1.__decorate([
1279
- (0, simple_database_1.column)({ type: 'integer' })
1280
- ], Email.prototype, "softFailedCount", void 0);
1281
- tslib_1.__decorate([
1282
- (0, simple_database_1.column)({ type: 'integer' })
1283
- ], Email.prototype, "failedCount", void 0);
1284
- tslib_1.__decorate([
1285
- (0, simple_database_1.column)({ type: 'integer' })
1286
- ], Email.prototype, "membersCount", void 0);
1287
- tslib_1.__decorate([
1288
- (0, simple_database_1.column)({ type: 'integer' })
1289
- ], Email.prototype, "hardBouncesCount", void 0);
1290
- tslib_1.__decorate([
1291
- (0, simple_database_1.column)({ type: 'integer' })
1292
- ], Email.prototype, "softBouncesCount", void 0);
1293
- tslib_1.__decorate([
1294
- (0, simple_database_1.column)({ type: 'integer' })
1295
- ], Email.prototype, "spamComplaintsCount", void 0);
1296
- tslib_1.__decorate([
1297
- (0, simple_database_1.column)({ type: 'string' })
1298
- ], Email.prototype, "status", void 0);
1299
- tslib_1.__decorate([
1300
- (0, simple_database_1.column)({ type: 'string' })
1301
- ], Email.prototype, "recipientsStatus", void 0);
1302
- tslib_1.__decorate([
1303
- (0, simple_database_1.column)({ type: 'json', nullable: true, decoder: simple_errors_1.SimpleErrors })
1304
- ], Email.prototype, "recipientsErrors", void 0);
1305
- tslib_1.__decorate([
1306
- (0, simple_database_1.column)({ type: 'json', nullable: true, decoder: simple_errors_1.SimpleErrors })
1307
- ], Email.prototype, "emailErrors", void 0);
1308
- tslib_1.__decorate([
1309
- (0, simple_database_1.column)({ type: 'json', decoder: new simple_encoding_1.ArrayDecoder(structures_1.EmailAttachment) })
1310
- ], Email.prototype, "attachments", void 0);
1311
- tslib_1.__decorate([
1312
- (0, simple_database_1.column)({
1313
- type: 'datetime',
1314
- nullable: true,
1315
- })
1316
- ], Email.prototype, "sentAt", void 0);
1317
- tslib_1.__decorate([
1318
- (0, simple_database_1.column)({
1319
- type: 'datetime',
1320
- nullable: true,
1321
- })
1322
- ], Email.prototype, "deletedAt", void 0);
1323
- tslib_1.__decorate([
1324
- (0, simple_database_1.column)({
1325
- type: 'datetime', beforeSave(old) {
1326
- if (old !== undefined) {
1327
- return old;
1328
- }
1329
- const date = new Date();
1330
- date.setMilliseconds(0);
1331
- return date;
1332
- },
1333
- })
1334
- ], Email.prototype, "createdAt", void 0);
1335
- tslib_1.__decorate([
1336
- (0, simple_database_1.column)({
1337
- type: 'datetime', beforeSave() {
1338
- const date = new Date();
1339
- date.setMilliseconds(0);
1340
- return date;
1341
- },
1342
- skipUpdate: true,
1343
- })
1344
- ], Email.prototype, "updatedAt", void 0);
1345
- //# sourceMappingURL=Email.js.map