@servicelabsco/slabs-access-manager 2.0.14 → 2.0.17

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 (419) hide show
  1. package/AGENTS.md +41 -4
  2. package/CLAUDE.md +12 -4
  3. package/dist/access/commands/index.d.ts +1 -0
  4. package/dist/access/commands/index.js +1 -0
  5. package/dist/access/commands/index.js.map +1 -1
  6. package/dist/access/commands/mail.log.backfill.business.command.d.ts +6 -0
  7. package/dist/access/commands/mail.log.backfill.business.command.js +65 -0
  8. package/dist/access/commands/mail.log.backfill.business.command.js.map +1 -0
  9. package/dist/access/controllers/alias.mapping.controller.d.ts +16 -0
  10. package/dist/access/controllers/alias.mapping.controller.js +93 -0
  11. package/dist/access/controllers/alias.mapping.controller.js.map +1 -0
  12. package/dist/access/controllers/bulk.upload.controller.d.ts +1 -1
  13. package/dist/access/controllers/bulk.upload.controller.js +1 -1
  14. package/dist/access/controllers/bulk.upload.controller.js.map +1 -1
  15. package/dist/access/controllers/business.email.alias.controller.d.ts +9 -0
  16. package/dist/access/controllers/business.email.alias.controller.js +43 -0
  17. package/dist/access/controllers/business.email.alias.controller.js.map +1 -0
  18. package/dist/access/controllers/business.email.controller.d.ts +2 -1
  19. package/dist/access/controllers/business.email.controller.js +6 -3
  20. package/dist/access/controllers/business.email.controller.js.map +1 -1
  21. package/dist/access/controllers/business.property.controller.d.ts +12 -4
  22. package/dist/access/controllers/business.property.controller.js +74 -7
  23. package/dist/access/controllers/business.property.controller.js.map +1 -1
  24. package/dist/access/controllers/developer.menu.controller.js.map +1 -1
  25. package/dist/access/controllers/developer.notification.type.controller.d.ts +16 -0
  26. package/dist/access/controllers/developer.notification.type.controller.js +91 -0
  27. package/dist/access/controllers/developer.notification.type.controller.js.map +1 -0
  28. package/dist/access/controllers/emithook.controller.d.ts +14 -0
  29. package/dist/access/controllers/emithook.controller.js +56 -0
  30. package/dist/access/controllers/emithook.controller.js.map +1 -0
  31. package/dist/access/controllers/index.d.ts +7 -0
  32. package/dist/access/controllers/index.js +7 -0
  33. package/dist/access/controllers/index.js.map +1 -1
  34. package/dist/access/controllers/mail.log.controller.d.ts +20 -0
  35. package/dist/access/controllers/mail.log.controller.js +76 -0
  36. package/dist/access/controllers/mail.log.controller.js.map +1 -0
  37. package/dist/access/controllers/notification.type.preference.controller.d.ts +12 -0
  38. package/dist/access/controllers/notification.type.preference.controller.js +59 -0
  39. package/dist/access/controllers/notification.type.preference.controller.js.map +1 -0
  40. package/dist/access/controllers/user.notification.type.preference.controller.d.ts +10 -0
  41. package/dist/access/controllers/user.notification.type.preference.controller.js +54 -0
  42. package/dist/access/controllers/user.notification.type.preference.controller.js.map +1 -0
  43. package/dist/access/dtos/add.alias.mapping.dto.d.ts +7 -0
  44. package/dist/access/dtos/add.alias.mapping.dto.js +49 -0
  45. package/dist/access/dtos/add.alias.mapping.dto.js.map +1 -0
  46. package/dist/access/dtos/add.business.email.dto.d.ts +4 -0
  47. package/dist/access/dtos/add.business.email.dto.js +34 -0
  48. package/dist/access/dtos/add.business.email.dto.js.map +1 -0
  49. package/dist/access/dtos/add.business.property.dto.d.ts +1 -0
  50. package/dist/access/dtos/add.business.property.dto.js +8 -0
  51. package/dist/access/dtos/add.business.property.dto.js.map +1 -1
  52. package/dist/access/dtos/business.email.attributes.dto.d.ts +1 -0
  53. package/dist/access/dtos/business.email.attributes.dto.js +6 -0
  54. package/dist/access/dtos/business.email.attributes.dto.js.map +1 -1
  55. package/dist/access/dtos/business.notification.type.preference.attributes.dto.d.ts +3 -0
  56. package/dist/access/dtos/business.notification.type.preference.attributes.dto.js +7 -0
  57. package/dist/access/dtos/business.notification.type.preference.attributes.dto.js.map +1 -0
  58. package/dist/access/dtos/business.property.identifier.param.dto.d.ts +3 -0
  59. package/dist/access/dtos/business.property.identifier.param.dto.js +25 -0
  60. package/dist/access/dtos/business.property.identifier.param.dto.js.map +1 -0
  61. package/dist/access/dtos/business.property.list.filter.dto.d.ts +4 -0
  62. package/dist/access/dtos/business.property.list.filter.dto.js +40 -0
  63. package/dist/access/dtos/business.property.list.filter.dto.js.map +1 -1
  64. package/dist/access/dtos/business.property.scope.dto.d.ts +3 -0
  65. package/dist/access/dtos/business.property.scope.dto.js +26 -0
  66. package/dist/access/dtos/business.property.scope.dto.js.map +1 -0
  67. package/dist/access/dtos/create.notification.type.dto.d.ts +14 -0
  68. package/dist/access/dtos/create.notification.type.dto.js +79 -0
  69. package/dist/access/dtos/create.notification.type.dto.js.map +1 -0
  70. package/dist/access/dtos/email.notification.payload.dto.d.ts +5 -0
  71. package/dist/access/dtos/email.notification.payload.dto.js.map +1 -1
  72. package/dist/access/dtos/emithook.envelope.dto.d.ts +38 -0
  73. package/dist/access/dtos/emithook.envelope.dto.js +16 -0
  74. package/dist/access/dtos/emithook.envelope.dto.js.map +1 -0
  75. package/dist/access/dtos/index.d.ts +15 -0
  76. package/dist/access/dtos/index.js +15 -0
  77. package/dist/access/dtos/index.js.map +1 -1
  78. package/dist/access/dtos/mail.log.content.query.dto.d.ts +4 -0
  79. package/dist/access/dtos/mail.log.content.query.dto.js +25 -0
  80. package/dist/access/dtos/mail.log.content.query.dto.js.map +1 -0
  81. package/dist/access/dtos/mail.log.list.filter.dto.d.ts +11 -0
  82. package/dist/access/dtos/mail.log.list.filter.dto.js +75 -0
  83. package/dist/access/dtos/mail.log.list.filter.dto.js.map +1 -0
  84. package/dist/access/dtos/notification.type.list.filter.dto.d.ts +7 -0
  85. package/dist/access/dtos/notification.type.list.filter.dto.js +45 -0
  86. package/dist/access/dtos/notification.type.list.filter.dto.js.map +1 -0
  87. package/dist/access/dtos/search.alias.mapping.dto.d.ts +7 -0
  88. package/dist/access/dtos/search.alias.mapping.dto.js +51 -0
  89. package/dist/access/dtos/search.alias.mapping.dto.js.map +1 -0
  90. package/dist/access/dtos/set.business.email.alias.dto.d.ts +3 -0
  91. package/dist/access/dtos/set.business.email.alias.dto.js +27 -0
  92. package/dist/access/dtos/set.business.email.alias.dto.js.map +1 -0
  93. package/dist/access/dtos/set.business.property.dto.d.ts +10 -0
  94. package/dist/access/dtos/set.business.property.dto.js +64 -0
  95. package/dist/access/dtos/set.business.property.dto.js.map +1 -0
  96. package/dist/access/dtos/set.notification.type.preference.dto.d.ts +5 -0
  97. package/dist/access/dtos/set.notification.type.preference.dto.js +34 -0
  98. package/dist/access/dtos/set.notification.type.preference.dto.js.map +1 -0
  99. package/dist/access/dtos/update.notification.type.dto.d.ts +13 -0
  100. package/dist/access/dtos/update.notification.type.dto.js +72 -0
  101. package/dist/access/dtos/update.notification.type.dto.js.map +1 -0
  102. package/dist/access/entities/access.mail.log.entity.d.ts +6 -0
  103. package/dist/access/entities/access.mail.log.entity.js +31 -0
  104. package/dist/access/entities/access.mail.log.entity.js.map +1 -0
  105. package/dist/access/entities/alias.mapping.entity.d.ts +11 -0
  106. package/dist/access/entities/alias.mapping.entity.js +51 -0
  107. package/dist/access/entities/alias.mapping.entity.js.map +1 -0
  108. package/dist/access/entities/business.email.entity.d.ts +1 -0
  109. package/dist/access/entities/business.email.entity.js +4 -0
  110. package/dist/access/entities/business.email.entity.js.map +1 -1
  111. package/dist/access/entities/business.notification.type.preference.entity.d.ts +13 -0
  112. package/dist/access/entities/business.notification.type.preference.entity.js +54 -0
  113. package/dist/access/entities/business.notification.type.preference.entity.js.map +1 -0
  114. package/dist/access/entities/index.d.ts +5 -0
  115. package/dist/access/entities/index.js +5 -0
  116. package/dist/access/entities/index.js.map +1 -1
  117. package/dist/access/entities/notification.type.entity.d.ts +16 -0
  118. package/dist/access/entities/notification.type.entity.js +63 -0
  119. package/dist/access/entities/notification.type.entity.js.map +1 -0
  120. package/dist/access/entities/user.notification.type.preference.entity.d.ts +15 -0
  121. package/dist/access/entities/user.notification.type.preference.entity.js +63 -0
  122. package/dist/access/entities/user.notification.type.preference.entity.js.map +1 -0
  123. package/dist/access/enums/business.email.type.enum.d.ts +3 -0
  124. package/dist/access/enums/business.email.type.enum.js +8 -0
  125. package/dist/access/enums/business.email.type.enum.js.map +1 -0
  126. package/dist/access/enums/index.d.ts +4 -0
  127. package/dist/access/enums/index.js +4 -0
  128. package/dist/access/enums/index.js.map +1 -1
  129. package/dist/access/enums/notification.channel.type.enum.d.ts +2 -1
  130. package/dist/access/enums/notification.channel.type.enum.js +1 -0
  131. package/dist/access/enums/notification.channel.type.enum.js.map +1 -1
  132. package/dist/access/enums/notification.suppression.reason.enum.d.ts +6 -0
  133. package/dist/access/enums/notification.suppression.reason.enum.js +11 -0
  134. package/dist/access/enums/notification.suppression.reason.enum.js.map +1 -0
  135. package/dist/access/enums/notification.type.audience.enum.d.ts +5 -0
  136. package/dist/access/enums/notification.type.audience.enum.js +10 -0
  137. package/dist/access/enums/notification.type.audience.enum.js.map +1 -0
  138. package/dist/access/enums/notification.type.control.enum.d.ts +4 -0
  139. package/dist/access/enums/notification.type.control.enum.js +9 -0
  140. package/dist/access/enums/notification.type.control.enum.js.map +1 -0
  141. package/dist/access/es6.classes.d.ts +61 -14
  142. package/dist/access/es6.classes.js +127 -1
  143. package/dist/access/es6.classes.js.map +1 -1
  144. package/dist/access/index.d.ts +1 -0
  145. package/dist/access/index.js +1 -0
  146. package/dist/access/index.js.map +1 -1
  147. package/dist/access/interfaces/alias.lookup.options.interface.d.ts +4 -0
  148. package/dist/access/interfaces/alias.lookup.options.interface.js +3 -0
  149. package/dist/access/interfaces/alias.lookup.options.interface.js.map +1 -0
  150. package/dist/access/interfaces/alias.mapping.input.interface.d.ts +7 -0
  151. package/dist/access/interfaces/alias.mapping.input.interface.js +3 -0
  152. package/dist/access/interfaces/alias.mapping.input.interface.js.map +1 -0
  153. package/dist/access/interfaces/alias.search.match.interface.d.ts +8 -0
  154. package/dist/access/interfaces/alias.search.match.interface.js +3 -0
  155. package/dist/access/interfaces/alias.search.match.interface.js.map +1 -0
  156. package/dist/access/interfaces/alias.search.query.interface.d.ts +7 -0
  157. package/dist/access/interfaces/alias.search.query.interface.js +3 -0
  158. package/dist/access/interfaces/alias.search.query.interface.js.map +1 -0
  159. package/dist/access/interfaces/business.email.alias.interface.d.ts +3 -0
  160. package/dist/access/interfaces/business.email.alias.interface.js +3 -0
  161. package/dist/access/interfaces/business.email.alias.interface.js.map +1 -0
  162. package/dist/access/interfaces/business.notification.type.preference.row.interface.d.ts +14 -0
  163. package/dist/access/interfaces/business.notification.type.preference.row.interface.js +3 -0
  164. package/dist/access/interfaces/business.notification.type.preference.row.interface.js.map +1 -0
  165. package/dist/access/interfaces/catalogued.notification.type.interface.d.ts +10 -0
  166. package/dist/access/interfaces/catalogued.notification.type.interface.js +3 -0
  167. package/dist/access/interfaces/catalogued.notification.type.interface.js.map +1 -0
  168. package/dist/access/interfaces/dropped.notification.recipient.interface.d.ts +5 -0
  169. package/dist/access/interfaces/dropped.notification.recipient.interface.js +3 -0
  170. package/dist/access/interfaces/dropped.notification.recipient.interface.js.map +1 -0
  171. package/dist/access/interfaces/emithook.email.body.interface.d.ts +24 -0
  172. package/dist/access/interfaces/emithook.email.body.interface.js +3 -0
  173. package/dist/access/interfaces/emithook.email.body.interface.js.map +1 -0
  174. package/dist/access/interfaces/emithook.email.status.event.interface.d.ts +23 -0
  175. package/dist/access/interfaces/emithook.email.status.event.interface.js +3 -0
  176. package/dist/access/interfaces/emithook.email.status.event.interface.js.map +1 -0
  177. package/dist/access/interfaces/emithook.template.email.request.interface.d.ts +15 -0
  178. package/dist/access/interfaces/emithook.template.email.request.interface.js +3 -0
  179. package/dist/access/interfaces/emithook.template.email.request.interface.js.map +1 -0
  180. package/dist/access/interfaces/emithook.template.email.result.interface.d.ts +6 -0
  181. package/dist/access/interfaces/emithook.template.email.result.interface.js +3 -0
  182. package/dist/access/interfaces/emithook.template.email.result.interface.js.map +1 -0
  183. package/dist/access/interfaces/inbound.email.message.interface.d.ts +31 -0
  184. package/dist/access/interfaces/inbound.email.message.interface.js +3 -0
  185. package/dist/access/interfaces/inbound.email.message.interface.js.map +1 -0
  186. package/dist/access/interfaces/index.d.ts +24 -0
  187. package/dist/access/interfaces/index.js +41 -0
  188. package/dist/access/interfaces/index.js.map +1 -0
  189. package/dist/access/interfaces/legacy.notification.preference.provider.interface.d.ts +5 -0
  190. package/dist/access/interfaces/legacy.notification.preference.provider.interface.js +3 -0
  191. package/dist/access/interfaces/legacy.notification.preference.provider.interface.js.map +1 -0
  192. package/dist/access/interfaces/notification.preference.request.interface.d.ts +9 -0
  193. package/dist/access/interfaces/notification.preference.request.interface.js +3 -0
  194. package/dist/access/interfaces/notification.preference.request.interface.js.map +1 -0
  195. package/dist/access/interfaces/notification.recipient.interface.d.ts +5 -0
  196. package/dist/access/interfaces/notification.recipient.interface.js +3 -0
  197. package/dist/access/interfaces/notification.recipient.interface.js.map +1 -0
  198. package/dist/access/interfaces/notification.send.identifiers.interface.d.ts +6 -0
  199. package/dist/access/interfaces/notification.send.identifiers.interface.js +3 -0
  200. package/dist/access/interfaces/notification.send.identifiers.interface.js.map +1 -0
  201. package/dist/access/interfaces/notification.send.recipient.interface.d.ts +5 -0
  202. package/dist/access/interfaces/notification.send.recipient.interface.js +3 -0
  203. package/dist/access/interfaces/notification.send.recipient.interface.js.map +1 -0
  204. package/dist/access/interfaces/notification.type.sources.interface.d.ts +5 -0
  205. package/dist/access/interfaces/notification.type.sources.interface.js +3 -0
  206. package/dist/access/interfaces/notification.type.sources.interface.js.map +1 -0
  207. package/dist/access/interfaces/notification.type.usage.interface.d.ts +12 -0
  208. package/dist/access/interfaces/notification.type.usage.interface.js +3 -0
  209. package/dist/access/interfaces/notification.type.usage.interface.js.map +1 -0
  210. package/dist/access/interfaces/resolve.notification.recipients.input.interface.d.ts +10 -0
  211. package/dist/access/interfaces/resolve.notification.recipients.input.interface.js +3 -0
  212. package/dist/access/interfaces/resolve.notification.recipients.input.interface.js.map +1 -0
  213. package/dist/access/interfaces/resolve.notification.recipients.result.interface.d.ts +10 -0
  214. package/dist/access/interfaces/resolve.notification.recipients.result.interface.js +3 -0
  215. package/dist/access/interfaces/resolve.notification.recipients.result.interface.js.map +1 -0
  216. package/dist/access/interfaces/send.emithook.template.email.options.interface.d.ts +18 -0
  217. package/dist/access/interfaces/send.emithook.template.email.options.interface.js +3 -0
  218. package/dist/access/interfaces/send.emithook.template.email.options.interface.js.map +1 -0
  219. package/dist/access/interfaces/user.notification.type.preference.row.interface.d.ts +11 -0
  220. package/dist/access/interfaces/user.notification.type.preference.row.interface.js +3 -0
  221. package/dist/access/interfaces/user.notification.type.preference.row.interface.js.map +1 -0
  222. package/dist/access/jobs/handle.emithook.email.job.d.ts +27 -0
  223. package/dist/access/jobs/handle.emithook.email.job.js +162 -0
  224. package/dist/access/jobs/handle.emithook.email.job.js.map +1 -0
  225. package/dist/access/jobs/handle.emithook.email.status.job.d.ts +8 -0
  226. package/dist/access/jobs/handle.emithook.email.status.job.js +31 -0
  227. package/dist/access/jobs/handle.emithook.email.status.job.js.map +1 -0
  228. package/dist/access/jobs/index.d.ts +5 -0
  229. package/dist/access/jobs/index.js +5 -0
  230. package/dist/access/jobs/index.js.map +1 -1
  231. package/dist/access/jobs/poll.emithook.email.inbox.job.d.ts +19 -0
  232. package/dist/access/jobs/poll.emithook.email.inbox.job.js +109 -0
  233. package/dist/access/jobs/poll.emithook.email.inbox.job.js.map +1 -0
  234. package/dist/access/jobs/poll.emithook.email.sqs.job.d.ts +22 -0
  235. package/dist/access/jobs/poll.emithook.email.sqs.job.js +91 -0
  236. package/dist/access/jobs/poll.emithook.email.sqs.job.js.map +1 -0
  237. package/dist/access/jobs/process.server.email.job.d.ts +1 -9
  238. package/dist/access/jobs/process.server.email.job.js +13 -105
  239. package/dist/access/jobs/process.server.email.job.js.map +1 -1
  240. package/dist/access/jobs/reconcile.emithook.email.status.job.d.ts +15 -0
  241. package/dist/access/jobs/reconcile.emithook.email.status.job.js +38 -0
  242. package/dist/access/jobs/reconcile.emithook.email.status.job.js.map +1 -0
  243. package/dist/access/libraries/apply.notification.preferences.d.ts +12 -0
  244. package/dist/access/libraries/apply.notification.preferences.js +51 -0
  245. package/dist/access/libraries/apply.notification.preferences.js.map +1 -0
  246. package/dist/access/libraries/delete.business.property.d.ts +7 -0
  247. package/dist/access/libraries/delete.business.property.js +18 -0
  248. package/dist/access/libraries/delete.business.property.js.map +1 -0
  249. package/dist/access/libraries/index.d.ts +19 -0
  250. package/dist/access/libraries/index.js +19 -0
  251. package/dist/access/libraries/index.js.map +1 -1
  252. package/dist/access/libraries/load.notification.preference.context.d.ts +10 -0
  253. package/dist/access/libraries/load.notification.preference.context.js +78 -0
  254. package/dist/access/libraries/load.notification.preference.context.js.map +1 -0
  255. package/dist/access/libraries/notification.type.catalogue.d.ts +12 -0
  256. package/dist/access/libraries/notification.type.catalogue.js +72 -0
  257. package/dist/access/libraries/notification.type.catalogue.js.map +1 -0
  258. package/dist/access/libraries/present.business.property.d.ts +4 -0
  259. package/dist/access/libraries/present.business.property.js +13 -0
  260. package/dist/access/libraries/present.business.property.js.map +1 -0
  261. package/dist/access/libraries/process.application.menu.js +6 -7
  262. package/dist/access/libraries/process.application.menu.js.map +1 -1
  263. package/dist/access/libraries/process.business.property.data.d.ts +6 -0
  264. package/dist/access/libraries/process.business.property.data.js +60 -20
  265. package/dist/access/libraries/process.business.property.data.js.map +1 -1
  266. package/dist/access/libraries/process.business.property.list.d.ts +4 -0
  267. package/dist/access/libraries/process.business.property.list.js +44 -5
  268. package/dist/access/libraries/process.business.property.list.js.map +1 -1
  269. package/dist/access/libraries/process.developer.menu.d.ts +2 -1
  270. package/dist/access/libraries/process.developer.menu.js +50 -20
  271. package/dist/access/libraries/process.developer.menu.js.map +1 -1
  272. package/dist/access/libraries/process.email.notification.d.ts +18 -3
  273. package/dist/access/libraries/process.email.notification.js +140 -3
  274. package/dist/access/libraries/process.email.notification.js.map +1 -1
  275. package/dist/access/libraries/process.emithook.email.status.d.ts +7 -0
  276. package/dist/access/libraries/process.emithook.email.status.js +40 -0
  277. package/dist/access/libraries/process.emithook.email.status.js.map +1 -0
  278. package/dist/access/libraries/process.inbound.email.message.d.ts +21 -0
  279. package/dist/access/libraries/process.inbound.email.message.js +129 -0
  280. package/dist/access/libraries/process.inbound.email.message.js.map +1 -0
  281. package/dist/access/libraries/process.mail.log.list.d.ts +25 -0
  282. package/dist/access/libraries/process.mail.log.list.js +90 -0
  283. package/dist/access/libraries/process.mail.log.list.js.map +1 -0
  284. package/dist/access/libraries/read.eml.attachments.d.ts +19 -0
  285. package/dist/access/libraries/read.eml.attachments.js +124 -0
  286. package/dist/access/libraries/read.eml.attachments.js.map +1 -0
  287. package/dist/access/libraries/reconcile.emithook.email.status.d.ts +17 -0
  288. package/dist/access/libraries/reconcile.emithook.email.status.js +82 -0
  289. package/dist/access/libraries/reconcile.emithook.email.status.js.map +1 -0
  290. package/dist/access/libraries/record.emithook.email.events.d.ts +15 -0
  291. package/dist/access/libraries/record.emithook.email.events.js +139 -0
  292. package/dist/access/libraries/record.emithook.email.events.js.map +1 -0
  293. package/dist/access/libraries/resolve.emithook.template.key.d.ts +8 -0
  294. package/dist/access/libraries/resolve.emithook.template.key.js +29 -0
  295. package/dist/access/libraries/resolve.emithook.template.key.js.map +1 -0
  296. package/dist/access/libraries/resolve.notification.recipients.d.ts +7 -0
  297. package/dist/access/libraries/resolve.notification.recipients.js +51 -0
  298. package/dist/access/libraries/resolve.notification.recipients.js.map +1 -0
  299. package/dist/access/libraries/sanitize.email.addresses.d.ts +3 -1
  300. package/dist/access/libraries/sanitize.email.addresses.js +3 -2
  301. package/dist/access/libraries/sanitize.email.addresses.js.map +1 -1
  302. package/dist/access/libraries/search.alias.mappings.d.ts +12 -0
  303. package/dist/access/libraries/search.alias.mappings.js +46 -0
  304. package/dist/access/libraries/search.alias.mappings.js.map +1 -0
  305. package/dist/access/libraries/send.email.notification.js +2 -0
  306. package/dist/access/libraries/send.email.notification.js.map +1 -1
  307. package/dist/access/libraries/send.emithook.template.email.d.ts +24 -0
  308. package/dist/access/libraries/send.emithook.template.email.js +188 -0
  309. package/dist/access/libraries/send.emithook.template.email.js.map +1 -0
  310. package/dist/access/libraries/set.alias.mapping.d.ts +12 -0
  311. package/dist/access/libraries/set.alias.mapping.js +81 -0
  312. package/dist/access/libraries/set.alias.mapping.js.map +1 -0
  313. package/dist/access/libraries/set.business.property.d.ts +8 -0
  314. package/dist/access/libraries/set.business.property.js +17 -0
  315. package/dist/access/libraries/set.business.property.js.map +1 -0
  316. package/dist/access/libraries/show.mail.log.content.d.ts +12 -0
  317. package/dist/access/libraries/show.mail.log.content.js +22 -0
  318. package/dist/access/libraries/show.mail.log.content.js.map +1 -0
  319. package/dist/access/libraries/show.mail.log.d.ts +6 -0
  320. package/dist/access/libraries/show.mail.log.js +20 -0
  321. package/dist/access/libraries/show.mail.log.js.map +1 -0
  322. package/dist/access/services/alias.mapping.service.d.ts +9 -0
  323. package/dist/access/services/alias.mapping.service.js +45 -0
  324. package/dist/access/services/alias.mapping.service.js.map +1 -0
  325. package/dist/access/services/business.email.alias.service.d.ts +5 -0
  326. package/dist/access/services/business.email.alias.service.js +35 -0
  327. package/dist/access/services/business.email.alias.service.js.map +1 -0
  328. package/dist/access/services/business.email.service.d.ts +5 -1
  329. package/dist/access/services/business.email.service.js +33 -2
  330. package/dist/access/services/business.email.service.js.map +1 -1
  331. package/dist/access/services/business.property.service.js +3 -1
  332. package/dist/access/services/business.property.service.js.map +1 -1
  333. package/dist/access/services/emithook.service.d.ts +36 -0
  334. package/dist/access/services/emithook.service.js +136 -0
  335. package/dist/access/services/emithook.service.js.map +1 -0
  336. package/dist/access/services/index.d.ts +7 -0
  337. package/dist/access/services/index.js +7 -0
  338. package/dist/access/services/index.js.map +1 -1
  339. package/dist/access/services/legacy.notification.preference.service.d.ts +8 -0
  340. package/dist/access/services/legacy.notification.preference.service.js +41 -0
  341. package/dist/access/services/legacy.notification.preference.service.js.map +1 -0
  342. package/dist/access/services/mail.log.access.service.d.ts +14 -0
  343. package/dist/access/services/mail.log.access.service.js +52 -0
  344. package/dist/access/services/mail.log.access.service.js.map +1 -0
  345. package/dist/access/services/notification.service.d.ts +2 -0
  346. package/dist/access/services/notification.service.js +19 -4
  347. package/dist/access/services/notification.service.js.map +1 -1
  348. package/dist/access/services/notification.type.preference.service.d.ts +25 -0
  349. package/dist/access/services/notification.type.preference.service.js +172 -0
  350. package/dist/access/services/notification.type.preference.service.js.map +1 -0
  351. package/dist/access/services/notification.type.service.d.ts +17 -0
  352. package/dist/access/services/notification.type.service.js +124 -0
  353. package/dist/access/services/notification.type.service.js.map +1 -0
  354. package/dist/access/services/send.email.service.d.ts +5 -1
  355. package/dist/access/services/send.email.service.js +9 -3
  356. package/dist/access/services/send.email.service.js.map +1 -1
  357. package/dist/accessUtility/controllers/bulk.definition.controller.d.ts +6 -2
  358. package/dist/accessUtility/controllers/bulk.definition.controller.js +26 -9
  359. package/dist/accessUtility/controllers/bulk.definition.controller.js.map +1 -1
  360. package/dist/accessUtility/dtos/bulk.definition.script.dto.d.ts +4 -0
  361. package/dist/accessUtility/dtos/bulk.definition.script.dto.js +30 -0
  362. package/dist/accessUtility/dtos/bulk.definition.script.dto.js.map +1 -0
  363. package/dist/accessUtility/dtos/index.d.ts +1 -0
  364. package/dist/accessUtility/dtos/index.js +1 -0
  365. package/dist/accessUtility/dtos/index.js.map +1 -1
  366. package/dist/accessUtility/es6.classes.d.ts +9 -7
  367. package/dist/accessUtility/es6.classes.js +12 -8
  368. package/dist/accessUtility/es6.classes.js.map +1 -1
  369. package/dist/accessUtility/jobs/analyse.bulk.upload.job.d.ts +1 -1
  370. package/dist/accessUtility/jobs/analyse.bulk.upload.job.js +1 -1
  371. package/dist/accessUtility/jobs/analyse.bulk.upload.job.js.map +1 -1
  372. package/dist/accessUtility/jobs/push.to.bulk.item.job.d.ts +2 -0
  373. package/dist/accessUtility/jobs/push.to.bulk.item.job.js +2 -0
  374. package/dist/accessUtility/jobs/push.to.bulk.item.job.js.map +1 -1
  375. package/dist/accessUtility/libraries/analyse.bulk.upload.d.ts +1 -1
  376. package/dist/accessUtility/libraries/index.d.ts +1 -1
  377. package/dist/accessUtility/libraries/index.js +1 -1
  378. package/dist/accessUtility/libraries/index.js.map +1 -1
  379. package/dist/accessUtility/libraries/process.bulk.definition.script.d.ts +9 -0
  380. package/dist/accessUtility/libraries/process.bulk.definition.script.js +43 -0
  381. package/dist/accessUtility/libraries/process.bulk.definition.script.js.map +1 -0
  382. package/dist/accessUtility/libraries/read.xls.file.d.ts +4 -1
  383. package/dist/accessUtility/libraries/read.xls.file.js +49 -10
  384. package/dist/accessUtility/libraries/read.xls.file.js.map +1 -1
  385. package/dist/accessUtility/services/index.d.ts +1 -0
  386. package/dist/accessUtility/services/index.js +1 -0
  387. package/dist/accessUtility/services/index.js.map +1 -1
  388. package/dist/accessUtility/{libraries → services}/match.bulk.upload.columns.d.ts +1 -1
  389. package/dist/accessUtility/{libraries → services}/match.bulk.upload.columns.js +4 -4
  390. package/dist/accessUtility/services/match.bulk.upload.columns.js.map +1 -0
  391. package/dist/migrations/1790855763155-CreateBzAliasMappingsTable.d.ts +8 -0
  392. package/dist/migrations/1790855763155-CreateBzAliasMappingsTable.js +37 -0
  393. package/dist/migrations/1790855763155-CreateBzAliasMappingsTable.js.map +1 -0
  394. package/dist/migrations/1792089460727-AddIdentifierBzBusinessEmailsTable.d.ts +5 -0
  395. package/dist/migrations/1792089460727-AddIdentifierBzBusinessEmailsTable.js +16 -0
  396. package/dist/migrations/1792089460727-AddIdentifierBzBusinessEmailsTable.js.map +1 -0
  397. package/dist/migrations/1792091262917-AddUniqueEmailIdentifierBzEmailMessagesTable.d.ts +8 -0
  398. package/dist/migrations/1792091262917-AddUniqueEmailIdentifierBzEmailMessagesTable.js +30 -0
  399. package/dist/migrations/1792091262917-AddUniqueEmailIdentifierBzEmailMessagesTable.js.map +1 -0
  400. package/dist/migrations/1792454400000-CreateSysNotificationTypesTable.d.ts +8 -0
  401. package/dist/migrations/1792454400000-CreateSysNotificationTypesTable.js +36 -0
  402. package/dist/migrations/1792454400000-CreateSysNotificationTypesTable.js.map +1 -0
  403. package/dist/migrations/1792454400001-CreateBzNotificationTypePreferencesTable.d.ts +8 -0
  404. package/dist/migrations/1792454400001-CreateBzNotificationTypePreferencesTable.js +31 -0
  405. package/dist/migrations/1792454400001-CreateBzNotificationTypePreferencesTable.js.map +1 -0
  406. package/dist/migrations/1792454400002-CreateBzUserNotificationTypePreferencesTable.d.ts +8 -0
  407. package/dist/migrations/1792454400002-CreateBzUserNotificationTypePreferencesTable.js +32 -0
  408. package/dist/migrations/1792454400002-CreateBzUserNotificationTypePreferencesTable.js.map +1 -0
  409. package/dist/migrations/1792454400003-AddSmsNotificationChannelDataSeederTable.d.ts +5 -0
  410. package/dist/migrations/1792454400003-AddSmsNotificationChannelDataSeederTable.js +21 -0
  411. package/dist/migrations/1792454400003-AddSmsNotificationChannelDataSeederTable.js.map +1 -0
  412. package/dist/migrations/1792532792345-AddBusinessIdSysMailLogsTable.d.ts +7 -0
  413. package/dist/migrations/1792532792345-AddBusinessIdSysMailLogsTable.js +20 -0
  414. package/dist/migrations/1792532792345-AddBusinessIdSysMailLogsTable.js.map +1 -0
  415. package/dist/migrations/1792573736107-AddEmithookIndexSysMailLogsTable.d.ts +5 -0
  416. package/dist/migrations/1792573736107-AddEmithookIndexSysMailLogsTable.js +14 -0
  417. package/dist/migrations/1792573736107-AddEmithookIndexSysMailLogsTable.js.map +1 -0
  418. package/package.json +1 -1
  419. package/dist/accessUtility/libraries/match.bulk.upload.columns.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"poll.emithook.email.sqs.job.js","sourceRoot":"","sources":["../../../src/access/jobs/poll.emithook.email.sqs.job.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,oFAAkI;AAClI,8FAAwF;AACxF,2EAAqE;AACrE,yFAAkF;AAS3E,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,mCAAS;IASlD,YACuB,YAA0B,EAC5B,UAAsB,EACtB,eAAgC,EAC9B,sBAA8C,EAC9C,4BAA0D;QAE7E,K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AC,CAAC;QAEhE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,IAAI,CAAC,QAAQ,qBAAqB,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;IAClG,CAAC;CACJ,CAAA;AAxFY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,mBAAU,GAAE;qCAW4B,sCAAY;QAChB,oCAAU;QACL,yCAAe;QACN,kDAAsB;QAChB,+DAA4B;GAdxE,uBAAuB,CAwFnC"}
@@ -9,13 +9,5 @@ export declare class ProcessServerEmailJob extends CommonJob {
9
9
  protected noDuplicate: boolean;
10
10
  constructor(queueService: QueueService, uploadService: UploadService, internalServerConnectService: InternalServerConnectService, syncEmailMessageMetricsJob: SyncEmailMessageMetricsJob);
11
11
  handle(id: number): Promise<EmailMessageEntity>;
12
- private setMessage;
13
- private setAttachments;
14
- private setAttachment;
15
- private setRecipients;
16
- private getBody;
17
- private getAttachment;
18
- private getSenderId;
19
- private getParentDetails;
20
- private getMessageIdentifier;
12
+ private toInbound;
21
13
  }
@@ -12,13 +12,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ProcessServerEmailJob = void 0;
13
13
  const common_1 = require("@nestjs/common");
14
14
  const nestjs_utility_services_1 = require("@servicelabsco/nestjs-utility-services");
15
- const typeorm_1 = require("typeorm");
16
15
  const business_email_entity_1 = require("../entities/business.email.entity");
17
- const email_attachment_entity_1 = require("../entities/email.attachment.entity");
18
- const email_message_entity_1 = require("../entities/email.message.entity");
19
- const email_recipient_entity_1 = require("../entities/email.recipient.entity");
16
+ const process_inbound_email_message_1 = require("../libraries/process.inbound.email.message");
20
17
  const sync_email_message_metrics_job_1 = require("./sync.email.message.metrics.job");
21
- const PG_UNIQUE_VIOLATION = '23505';
22
18
  let ProcessServerEmailJob = class ProcessServerEmailJob extends nestjs_utility_services_1.CommonJob {
23
19
  constructor(queueService, uploadService, internalServerConnectService, syncEmailMessageMetricsJob) {
24
20
  super('6dc279beaec1891635dab7b1c7e76be3');
@@ -36,106 +32,18 @@ let ProcessServerEmailJob = class ProcessServerEmailJob extends nestjs_utility_s
36
32
  const email = await business_email_entity_1.BusinessEmailEntity.findOne({ where: { meta_server_id: data.email_id }, relations: ['business'] });
37
33
  if (!email)
38
34
  return null;
39
- return this.setMessage(email, data);
40
- }
41
- async setMessage(email, payload) {
42
- const message = await email_message_entity_1.EmailMessageEntity.firstOrNew({ email_id: email.id, identifier: payload.identifier });
43
- message.subject = payload.subject;
44
- message.from_email = payload.from_email;
45
- message.sender_id = await this.getSenderId(payload.from_email);
46
- message.tracking_identifier = this.getMessageIdentifier(payload);
47
- message.body = await this.getBody(email, payload.body);
48
- message.attributes = { ...message.attributes, ...payload.attributes };
49
- message.emailed_at = payload.attributes?.date || null;
50
- const parent = await this.getParentDetails(message);
51
- message.parent_id = parent?.parent_id || parent?.id || null;
52
- try {
53
- await message.save();
54
- }
55
- catch (e) {
56
- if (e instanceof typeorm_1.QueryFailedError && e.driverError?.code === PG_UNIQUE_VIOLATION) {
57
- const existing = await email_message_entity_1.EmailMessageEntity.findOne({
58
- where: { email_id: email.id, identifier: payload.identifier, deleted_at: (0, typeorm_1.IsNull)() },
59
- });
60
- if (existing)
61
- return existing;
62
- }
63
- throw e;
64
- }
65
- await this.setAttachments(email, message, payload.attachments);
66
- await this.setRecipients(message, payload.recipients);
67
- await this.syncEmailMessageMetricsJob.delayedDispatch(message.id);
68
- return message;
69
- }
70
- async setAttachments(email, message, attachments) {
71
- if (!Array.isArray(attachments))
72
- return;
73
- for (const attachment of attachments)
74
- await this.setAttachment(email, message, attachment);
75
- }
76
- async setAttachment(email, message, attachment) {
77
- try {
78
- const url = await this.getAttachment(email, attachment);
79
- const r = await email_attachment_entity_1.EmailAttachmentEntity.firstOrNew({ message_id: message.id, name: attachment.name });
80
- r.url = url;
81
- r.attributes = { ...r.attributes, size: attachment.size };
82
- return r.save();
83
- }
84
- catch {
85
- global.console.log('cannot find attachment url : ', attachment?.url);
86
- }
87
- }
88
- async setRecipients(message, recipients) {
89
- const nodes = ['to', 'cc'];
90
- for (const node of nodes) {
91
- const records = recipients.to;
92
- if (!Array.isArray(records))
93
- continue;
94
- for (const record of records) {
95
- const r = await email_recipient_entity_1.EmailRecipientEntity.firstOrNew({ message_id: message.id, type: node, email: record.email });
96
- r.attributes = { ...r.attributes, name: record.name };
97
- await r.save();
98
- }
99
- }
100
- }
101
- async getBody(email, url) {
102
- const originalname = `${Date.now()}.${nestjs_utility_services_1.PlatformUtility.generateRandomAlpha(6).toLowerCase()}.emailBody.html`;
103
- const file = { url, originalname };
104
- const params = { folder: `business/${email.business.identifier}/email/body`, acl: 'private' };
105
- return this.uploadService.upload(file, params);
106
- }
107
- async getAttachment(email, attachment) {
108
- const file = { url: attachment.url, originalname: attachment.name };
109
- const params = { folder: `business/${email.business.identifier}/email/attachments`, acl: 'private' };
110
- return this.uploadService.upload(file, params);
111
- }
112
- async getSenderId(email) {
113
- const user = await nestjs_utility_services_1.UserEntity.findOne({ where: { email } });
114
- return user?.id || null;
115
- }
116
- async getParentDetails(message) {
117
- let identifiers = [];
118
- const { in_reply_to, references } = message.attributes;
119
- if (in_reply_to)
120
- identifiers.push(in_reply_to);
121
- if (references?.length)
122
- identifiers = identifiers.concat(references);
123
- identifiers = identifiers.filter((item) => {
124
- return item?.length && item;
125
- });
126
- if (!identifiers.length)
127
- return;
128
- for (const identifier of identifiers) {
129
- const parent = await email_message_entity_1.EmailMessageEntity.findOne({ where: { email_id: message.email_id, tracking_identifier: identifier } });
130
- if (parent)
131
- return parent;
132
- }
133
- }
134
- getMessageIdentifier(payload) {
135
- const { in_reply_to, references, message_id } = payload?.attributes || {};
136
- if (!in_reply_to && references?.length === 1)
137
- return references[0];
138
- return message_id;
35
+ return new process_inbound_email_message_1.ProcessInboundEmailMessage(this.uploadService, this.syncEmailMessageMetricsJob).process(email, this.toInbound(data));
36
+ }
37
+ toInbound(data) {
38
+ return {
39
+ identifier: data.identifier,
40
+ from_email: data.from_email,
41
+ subject: data.subject,
42
+ body: { url: data.body },
43
+ recipients: data.recipients,
44
+ attachments: data.attachments,
45
+ attributes: data.attributes,
46
+ };
139
47
  }
140
48
  };
141
49
  exports.ProcessServerEmailJob = ProcessServerEmailJob;
@@ -1 +1 @@
1
- {"version":3,"file":"process.server.email.job.js","sourceRoot":"","sources":["../../../src/access/jobs/process.server.email.job.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,oFAQgD;AAChD,qCAAmD;AAInD,6EAAwE;AACxE,iFAA4E;AAC5E,2EAAsE;AACtE,+EAA0E;AAC1E,qFAA8E;AAE9E,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAO7B,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,mCAAS;IAGhD,YACuB,YAA0B,EAC5B,aAA4B,EAC1B,4BAA0D,EAC5D,0BAAsD;QAEvE,KAAK,CAAC,kCAAkC,CAAC,CAAC;QALvB,iBAAY,GAAZ,YAAY,CAAc;QAC5B,kBAAa,GAAb,aAAa,CAAe;QAC1B,iCAA4B,GAA5B,4BAA4B,CAA8B;QAC5D,+BAA0B,GAA1B,0BAA0B,CAA4B;QANjE,gBAAW,GAAG,IAAI,CAAC;IAS7B,CAAC;IAOD,KAAK,CAAC,MAAM,CAAC,EAAU;QACnB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,4BAA4B,CAAC,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAC;QAE5F,MAAM,IAAI,GAAG,QAAQ,EAAE,IAAI,CAAC;QAC5B,IAAI,CAAC,IAAI,EAAE,QAAQ;YAAE,OAAO,IAAI,CAAC;QAEjC,MAAM,KAAK,GAAG,MAAM,2CAAmB,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,cAAc,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QAEvH,IAAI,CAAC,KAAK;YAAE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from '../services/emithook.service';
3
+ export declare class ReconcileEmithookEmailStatusJob extends CommonJob {
4
+ protected readonly queueService: QueueService;
5
+ private readonly sqlService;
6
+ private readonly emithookService;
7
+ protected noDuplicate: boolean;
8
+ protected priority: number;
9
+ protected timeout: number;
10
+ constructor(queueService: QueueService, sqlService: SqlService, emithookService: EmithookService);
11
+ handle(): Promise<{
12
+ checked: number;
13
+ failed: number;
14
+ }>;
15
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ReconcileEmithookEmailStatusJob = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const nestjs_utility_services_1 = require("@servicelabsco/nestjs-utility-services");
15
+ const reconcile_emithook_email_status_1 = require("../libraries/reconcile.emithook.email.status");
16
+ const emithook_service_1 = require("../services/emithook.service");
17
+ let ReconcileEmithookEmailStatusJob = class ReconcileEmithookEmailStatusJob extends nestjs_utility_services_1.CommonJob {
18
+ constructor(queueService, sqlService, emithookService) {
19
+ super('f916349a2c0dd2a19047bb0130305ead');
20
+ this.queueService = queueService;
21
+ this.sqlService = sqlService;
22
+ this.emithookService = emithookService;
23
+ this.noDuplicate = true;
24
+ this.priority = 10;
25
+ this.timeout = 600000;
26
+ }
27
+ async handle() {
28
+ return new reconcile_emithook_email_status_1.ReconcileEmithookEmailStatus(this.sqlService, this.emithookService).process();
29
+ }
30
+ };
31
+ exports.ReconcileEmithookEmailStatusJob = ReconcileEmithookEmailStatusJob;
32
+ exports.ReconcileEmithookEmailStatusJob = ReconcileEmithookEmailStatusJob = __decorate([
33
+ (0, common_1.Injectable)(),
34
+ __metadata("design:paramtypes", [nestjs_utility_services_1.QueueService,
35
+ nestjs_utility_services_1.SqlService,
36
+ emithook_service_1.EmithookService])
37
+ ], ReconcileEmithookEmailStatusJob);
38
+ //# sourceMappingURL=reconcile.emithook.email.status.job.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reconcile.emithook.email.status.job.js","sourceRoot":"","sources":["../../../src/access/jobs/reconcile.emithook.email.status.job.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,oFAA6F;AAC7F,kGAA4F;AAC5F,mEAA+D;AAQxD,IAAM,+BAA+B,GAArC,MAAM,+BAAgC,SAAQ,mCAAS;IAK1D,YACuB,YAA0B,EAC5B,UAAsB,EACtB,eAAgC;QAEjD,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAJvB,iBAAY,GAAZ,YAAY,CAAc;QAC5B,eAAU,GAAV,UAAU,CAAY;QACtB,oBAAe,GAAf,eAAe,CAAiB;QAP3C,gBAAW,GAAG,IAAI,CAAC;QACnB,aAAQ,GAAG,EAAE,CAAC;QACd,YAAO,GAAW,MAAM,CAAC;IAQnC,CAAC;IAKD,KAAK,CAAC,MAAM;QACR,OAAO,IAAI,8DAA4B,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,OAAO,EAAE,CAAC;IAC7F,CAAC;CACJ,CAAA;AAnBY,0EAA+B;0CAA/B,+BAA+B;IAD3C,IAAA,mBAAU,GAAE;qCAO4B,sCAAY;QAChB,oCAAU;QACL,kCAAe;GAR5C,+BAA+B,CAmB3C"}
@@ -0,0 +1,12 @@
1
+ import { NotificationChannelTypeEnum } from '../enums/notification.channel.type.enum';
2
+ import { NotificationPreferenceRequestInterface } from '../interfaces/notification.preference.request.interface';
3
+ import { NotificationSendIdentifiersInterface } from '../interfaces/notification.send.identifiers.interface';
4
+ import { ResolveNotificationRecipientsResultInterface } from '../interfaces/resolve.notification.recipients.result.interface';
5
+ export declare class ApplyNotificationPreferences {
6
+ static readonly UNCATALOGUED_LOG_INTERVAL: number;
7
+ private static uncataloguedLoggedAt;
8
+ static clearUncataloguedLog(): void;
9
+ process(request: NotificationPreferenceRequestInterface): Promise<ResolveNotificationRecipientsResultInterface>;
10
+ allowedUserIds(identifiers: NotificationSendIdentifiersInterface, channel: NotificationChannelTypeEnum, businessId: number | null, userIds: number[]): Promise<number[]>;
11
+ private logUncatalogued;
12
+ }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApplyNotificationPreferences = void 0;
4
+ const load_notification_preference_context_1 = require("./load.notification.preference.context");
5
+ const resolve_notification_recipients_1 = require("./resolve.notification.recipients");
6
+ class ApplyNotificationPreferences {
7
+ static clearUncataloguedLog() {
8
+ ApplyNotificationPreferences.uncataloguedLoggedAt.clear();
9
+ }
10
+ async process(request) {
11
+ try {
12
+ const context = await new load_notification_preference_context_1.LoadNotificationPreferenceContext().process(request);
13
+ if (!context.type)
14
+ this.logUncatalogued(request);
15
+ return new resolve_notification_recipients_1.ResolveNotificationRecipients().process(context);
16
+ }
17
+ catch (error) {
18
+ const message = error instanceof Error ? error.message : String(error);
19
+ global.console.error(`Notification preference check failed, sending as before: ${message}`);
20
+ const recipients = (request.recipients || []).map((r) => ({ address: r.address, role: r.role, user_ids: r.user_id ? [r.user_id] : [] }));
21
+ return { send: true, recipients, dropped: [] };
22
+ }
23
+ }
24
+ async allowedUserIds(identifiers, channel, businessId, userIds) {
25
+ if (!userIds?.length)
26
+ return userIds || [];
27
+ const recipients = userIds.map((id) => ({ address: `user:${id}`, role: 'to', user_id: id }));
28
+ const result = await this.process({ identifiers, channel, business_id: businessId, recipients });
29
+ if (!result.send)
30
+ return [];
31
+ const allowed = new Set(result.recipients.map((r) => r.address));
32
+ return userIds.filter((id) => allowed.has(`user:${id}`));
33
+ }
34
+ logUncatalogued(request) {
35
+ const { type, notification, email_template, email_notification } = request.identifiers || {};
36
+ const identifier = type || notification || email_template || email_notification;
37
+ if (!identifier)
38
+ return;
39
+ const key = `${request.channel}:${identifier}`;
40
+ const now = Date.now();
41
+ const last = ApplyNotificationPreferences.uncataloguedLoggedAt.get(key) || 0;
42
+ if (now - last < ApplyNotificationPreferences.UNCATALOGUED_LOG_INTERVAL)
43
+ return;
44
+ ApplyNotificationPreferences.uncataloguedLoggedAt.set(key, now);
45
+ global.console.log(`Notification preference check: uncatalogued ${key}`);
46
+ }
47
+ }
48
+ exports.ApplyNotificationPreferences = ApplyNotificationPreferences;
49
+ ApplyNotificationPreferences.UNCATALOGUED_LOG_INTERVAL = 60 * 60 * 1000;
50
+ ApplyNotificationPreferences.uncataloguedLoggedAt = new Map();
51
+ //# sourceMappingURL=apply.notification.preferences.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply.notification.preferences.js","sourceRoot":"","sources":["../../../src/access/libraries/apply.notification.preferences.ts"],"names":[],"mappings":";;;AAIA,iGAA2F;AAC3F,uFAAkF;AAQlF,MAAa,4BAA4B;IAQrC,MAAM,CAAC,oBAAoB;QACvB,4BAA4B,CAAC,oBAAoB,CAAC,KAAK,EAAE,CAAC;IAC9D,CAAC;IAOD,KAAK,CAAC,OAAO,CAAC,OAA+C;QACzD,IAAI,CAAC;YACD,MAAM,OAAO,GAAG,MAAM,IAAI,wEAAiC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC/E,IAAI,CAAC,OAAO,CAAC,IAAI;gBAAE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;YAEjD,OAAO,IAAI,+DAA6B,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAChE,CAAC;Q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GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QACjE,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;IAC7D,CAAC;IAOO,eAAe,CAAC,OAA+C;QACnE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC;QAC7F,MAAM,UAAU,GAAG,IAAI,IAAI,YAAY,IAAI,cAAc,IAAI,kBAAkB,CAAC;QAChF,IAAI,CAAC,UAAU;YAAE,OAAO;QAExB,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,OAAO,IAAI,UAAU,EAAE,CAAC;QAC/C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,MAAM,IAAI,GAAG,4BAA4B,CAAC,oBAAoB,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC7E,IAAI,GAAG,GAAG,IAAI,GAAG,4BAA4B,CAAC,yBAAyB;YAAE,OAAO;QAEhF,4BAA4B,CAAC,oBAAoB,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QAChE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,+CAA+C,GAAG,EAAE,CAAC,CAAC;IAC7E,CAAC;;AA1EL,oEA2EC;AAzEmB,sDAAyB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAG5C,iDAAoB,GAAG,IAAI,GAAG,EAAkB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { AccessBusinessEntity } from '../entities/access.business.entity';
2
+ import { BusinessPropertyEntity } from '../entities/business.property.entity';
3
+ export declare class DeleteBusinessProperty {
4
+ private readonly business;
5
+ constructor(business: AccessBusinessEntity);
6
+ process(id: number): Promise<BusinessPropertyEntity>;
7
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteBusinessProperty = void 0;
4
+ const nestjs_utility_services_1 = require("@servicelabsco/nestjs-utility-services");
5
+ const business_property_entity_1 = require("../entities/business.property.entity");
6
+ class DeleteBusinessProperty {
7
+ constructor(business) {
8
+ this.business = business;
9
+ }
10
+ async process(id) {
11
+ const property = await business_property_entity_1.BusinessPropertyEntity.findOne({ where: { id, business_id: this.business.id } });
12
+ if (!property)
13
+ throw new nestjs_utility_services_1.AccessException();
14
+ return property.softDelete();
15
+ }
16
+ }
17
+ exports.DeleteBusinessProperty = DeleteBusinessProperty;
18
+ //# sourceMappingURL=delete.business.property.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.business.property.js","sourceRoot":"","sources":["../../../src/access/libraries/delete.business.property.ts"],"names":[],"mappings":";;;AAAA,oFAAyE;AAEzE,mFAA8E;AAM9E,MAAa,sBAAsB;IAC/B,YAA6B,QAA8B;QAA9B,aAAQ,GAAR,QAAQ,CAAsB;IAAG,CAAC;IAO/D,KAAK,CAAC,OAAO,CAAC,EAAU;QACpB,MAAM,QAAQ,GAAG,MAAM,iDAAsB,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACxG,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,yCAAe,EAAE,CAAC;QAE3C,OAAO,QAAQ,CAAC,UAAU,EAAE,CAAC;IACjC,CAAC;CACJ;AAdD,wDAcC"}
@@ -1,14 +1,19 @@
1
1
  export * from './apply.menu.layout';
2
+ export * from './apply.notification.preferences';
2
3
  export * from './assert.safe.sql.fragment';
3
4
  export * from './business.ui.action.availability';
4
5
  export * from './common.tag.controller';
5
6
  export * from './conversation.controller';
6
7
  export * from './create.user.business.secret';
7
8
  export * from './date.fn';
9
+ export * from './delete.business.property';
8
10
  export * from './evaluate.email.rule';
9
11
  export * from './execute.business.script';
10
12
  export * from './extract.client.credentials';
13
+ export * from './load.notification.preference.context';
14
+ export * from './notification.type.catalogue';
11
15
  export * from './oauth.pkce';
16
+ export * from './present.business.property';
12
17
  export * from './process.amazon.integration';
13
18
  export * from './process.api.account.data';
14
19
  export * from './process.api.account.list';
@@ -56,6 +61,7 @@ export * from './process.downloadable.reports.list';
56
61
  export * from './process.email.notification';
57
62
  export * from './process.email.rule.data';
58
63
  export * from './process.email.rule.list';
64
+ export * from './process.emithook.email.status';
59
65
  export * from './process.event.trigger.data';
60
66
  export * from './process.event.trigger.list';
61
67
  export * from './process.event.trigger.log.list';
@@ -69,6 +75,7 @@ export * from './process.group.member.updation';
69
75
  export * from './process.group.role.list';
70
76
  export * from './process.gst.mapping.data';
71
77
  export * from './process.gst.mapping.list';
78
+ export * from './process.inbound.email.message';
72
79
  export * from './process.internal.notification';
73
80
  export * from './process.listing.csv.file';
74
81
  export * from './process.listing.order';
@@ -76,6 +83,7 @@ export * from './process.listing.page.creation';
76
83
  export * from './process.listing.page.query';
77
84
  export * from './process.lock.script.data';
78
85
  export * from './process.lock.script.list';
86
+ export * from './process.mail.log.list';
79
87
  export * from './process.menu.creation';
80
88
  export * from './process.menu.details';
81
89
  export * from './process.module.creation';
@@ -99,12 +107,19 @@ export * from './process.user.notification.list';
99
107
  export * from './process.whatsapp.integration';
100
108
  export * from './process.whatsapp.message';
101
109
  export * from './process.zoho.integration';
110
+ export * from './read.eml.attachments';
111
+ export * from './reconcile.emithook.email.status';
112
+ export * from './record.emithook.email.events';
102
113
  export * from './report.view.enablement';
103
114
  export * from './report.view.query.compiler';
104
115
  export * from './resolve.client.ip';
116
+ export * from './resolve.emithook.template.key';
117
+ export * from './resolve.notification.recipients';
105
118
  export * from './sanitize.email.addresses';
119
+ export * from './search.alias.mappings';
106
120
  export * from './search.developer.businesses';
107
121
  export * from './send.email.notification';
122
+ export * from './send.emithook.template.email';
108
123
  export * from './send.fcm.notification';
109
124
  export * from './send.gchat.message.notification';
110
125
  export * from './send.gchat.webhook.notification';
@@ -112,7 +127,11 @@ export * from './send.slack.message.notification';
112
127
  export * from './send.slack.webhook.notification.';
113
128
  export * from './send.webhook.request';
114
129
  export * from './send.whatsapp.message.notification';
130
+ export * from './set.alias.mapping';
131
+ export * from './set.business.property';
115
132
  export * from './set.fcm.token';
133
+ export * from './show.mail.log.content';
134
+ export * from './show.mail.log';
116
135
  export * from './sync.business.user.role';
117
136
  export * from './ui.action.businesses';
118
137
  export * from './user.secret.view';
@@ -15,16 +15,21 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./apply.menu.layout"), exports);
18
+ __exportStar(require("./apply.notification.preferences"), exports);
18
19
  __exportStar(require("./assert.safe.sql.fragment"), exports);
19
20
  __exportStar(require("./business.ui.action.availability"), exports);
20
21
  __exportStar(require("./common.tag.controller"), exports);
21
22
  __exportStar(require("./conversation.controller"), exports);
22
23
  __exportStar(require("./create.user.business.secret"), exports);
23
24
  __exportStar(require("./date.fn"), exports);
25
+ __exportStar(require("./delete.business.property"), exports);
24
26
  __exportStar(require("./evaluate.email.rule"), exports);
25
27
  __exportStar(require("./execute.business.script"), exports);
26
28
  __exportStar(require("./extract.client.credentials"), exports);
29
+ __exportStar(require("./load.notification.preference.context"), exports);
30
+ __exportStar(require("./notification.type.catalogue"), exports);
27
31
  __exportStar(require("./oauth.pkce"), exports);
32
+ __exportStar(require("./present.business.property"), exports);
28
33
  __exportStar(require("./process.amazon.integration"), exports);
29
34
  __exportStar(require("./process.api.account.data"), exports);
30
35
  __exportStar(require("./process.api.account.list"), exports);
@@ -72,6 +77,7 @@ __exportStar(require("./process.downloadable.reports.list"), exports);
72
77
  __exportStar(require("./process.email.notification"), exports);
73
78
  __exportStar(require("./process.email.rule.data"), exports);
74
79
  __exportStar(require("./process.email.rule.list"), exports);
80
+ __exportStar(require("./process.emithook.email.status"), exports);
75
81
  __exportStar(require("./process.event.trigger.data"), exports);
76
82
  __exportStar(require("./process.event.trigger.list"), exports);
77
83
  __exportStar(require("./process.event.trigger.log.list"), exports);
@@ -85,6 +91,7 @@ __exportStar(require("./process.group.member.updation"), exports);
85
91
  __exportStar(require("./process.group.role.list"), exports);
86
92
  __exportStar(require("./process.gst.mapping.data"), exports);
87
93
  __exportStar(require("./process.gst.mapping.list"), exports);
94
+ __exportStar(require("./process.inbound.email.message"), exports);
88
95
  __exportStar(require("./process.internal.notification"), exports);
89
96
  __exportStar(require("./process.listing.csv.file"), exports);
90
97
  __exportStar(require("./process.listing.order"), exports);
@@ -92,6 +99,7 @@ __exportStar(require("./process.listing.page.creation"), exports);
92
99
  __exportStar(require("./process.listing.page.query"), exports);
93
100
  __exportStar(require("./process.lock.script.data"), exports);
94
101
  __exportStar(require("./process.lock.script.list"), exports);
102
+ __exportStar(require("./process.mail.log.list"), exports);
95
103
  __exportStar(require("./process.menu.creation"), exports);
96
104
  __exportStar(require("./process.menu.details"), exports);
97
105
  __exportStar(require("./process.module.creation"), exports);
@@ -115,12 +123,19 @@ __exportStar(require("./process.user.notification.list"), exports);
115
123
  __exportStar(require("./process.whatsapp.integration"), exports);
116
124
  __exportStar(require("./process.whatsapp.message"), exports);
117
125
  __exportStar(require("./process.zoho.integration"), exports);
126
+ __exportStar(require("./read.eml.attachments"), exports);
127
+ __exportStar(require("./reconcile.emithook.email.status"), exports);
128
+ __exportStar(require("./record.emithook.email.events"), exports);
118
129
  __exportStar(require("./report.view.enablement"), exports);
119
130
  __exportStar(require("./report.view.query.compiler"), exports);
120
131
  __exportStar(require("./resolve.client.ip"), exports);
132
+ __exportStar(require("./resolve.emithook.template.key"), exports);
133
+ __exportStar(require("./resolve.notification.recipients"), exports);
121
134
  __exportStar(require("./sanitize.email.addresses"), exports);
135
+ __exportStar(require("./search.alias.mappings"), exports);
122
136
  __exportStar(require("./search.developer.businesses"), exports);
123
137
  __exportStar(require("./send.email.notification"), exports);
138
+ __exportStar(require("./send.emithook.template.email"), exports);
124
139
  __exportStar(require("./send.fcm.notification"), exports);
125
140
  __exportStar(require("./send.gchat.message.notification"), exports);
126
141
  __exportStar(require("./send.gchat.webhook.notification"), exports);
@@ -128,7 +143,11 @@ __exportStar(require("./send.slack.message.notification"), exports);
128
143
  __exportStar(require("./send.slack.webhook.notification."), exports);
129
144
  __exportStar(require("./send.webhook.request"), exports);
130
145
  __exportStar(require("./send.whatsapp.message.notification"), exports);
146
+ __exportStar(require("./set.alias.mapping"), exports);
147
+ __exportStar(require("./set.business.property"), exports);
131
148
  __exportStar(require("./set.fcm.token"), exports);
149
+ __exportStar(require("./show.mail.log.content"), exports);
150
+ __exportStar(require("./show.mail.log"), exports);
132
151
  __exportStar(require("./sync.business.user.role"), exports);
133
152
  __exportStar(require("./ui.action.businesses"), exports);
134
153
  __exportStar(require("./user.secret.view"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/access/libraries/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,sDAAoC;AACpC,6DAA2C;AAC3C,oEAAkD;AAClD,0DAAwC;AACxC,4DAA0C;AAC1C,gEAA8C;AAC9C,4CAA0B;AAC1B,wDAAsC;AACtC,4DAA0C;AAC1C,+DAA6C;AAC7C,+CAA6B;AAC7B,+DAA6C;AAC7C,6DAA2C;AAC3C,6DAA2C;AAC3C,4DAA0C;AAC1C,6DAA2C;AAC3C,kEAAgD;AAChD,6DAA2C;AAC3C,mEAAiD;AACjD,gEAA8C;AAC9C,sEAAoD;AACpD,sEAAoD;AACpD,yEAAuD;AACvD,0FAAwE;AACxE,mEAAiD;AACjD,mEAAiD;AACjD,iEAA+C;AAC/C,qEAAmD;AACnD,iEAA+C;AAC/C,iEAA+C;AAC/C,+DAA6C;AAC7C,qEAAmD;AACnD,uFAAqE;AACrE,sE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AACxC,8DAA4C;AAC5C,kEAAgD;AAChD,4DAA0C;AAC1C,6DAA2C;AAC3C,6DAA2C;AAC3C,kEAAgD;AAChD,kEAAgD;AAChD,6DAA2C;AAC3C,0DAAwC;AACxC,kEAAgD;AAChD,+DAA6C;AAC7C,6DAA2C;AAC3C,6DAA2C;AAC3C,0DAAwC;AACxC,0DAAwC;AACxC,yDAAuC;AACvC,4DAA0C;AAC1C,iEAA+C;AAC/C,yDAAuC;AACvC,mEAAiD;AACjD,mEAAiD;AACjD,4DAA0C;AAC1C,wDAAsC;AACtC,8DAA4C;AAC5C,qEAAmD;AACnD,oEAAkD;AAClD,kEAAgD;AAChD,uEAAqD;AACrD,kEAAgD;AAChD,8DAA4C;AAC5C,0DAAwC;AACxC,sDAAoC;AACpC,gEAA8C;AAC9C,mEAAiD;AACjD,iEAA+C;AAC/C,6DAA2C;AAC3C,6DAA2C;AAC3C,yDAAuC;AACvC,oEAAkD;AAClD,iEAA+C;AAC/C,2DAAyC;AACzC,+DAA6C;AAC7C,sDAAoC;AACpC,kEAAgD;AAChD,oEAAkD;AAClD,6DAA2C;AAC3C,0DAAwC;AACxC,gEAA8C;AAC9C,4DAA0C;AAC1C,iEAA+C;AAC/C,0DAAwC;AACxC,oEAAkD;AAClD,oEAAkD;AAClD,oEAAkD;AAClD,qEAAmD;AACnD,yDAAuC;AACvC,uEAAqD;AACrD,sDAAoC;AACpC,0DAAwC;AACxC,kDAAgC;AAChC,0DAAwC;AACxC,kDAAgC;AAChC,4DAA0C;AAC1C,yDAAuC;AACvC,qDAAmC;AACnC,+DAA6C"}
@@ -0,0 +1,10 @@
1
+ import { NotificationPreferenceRequestInterface } from '../interfaces/notification.preference.request.interface';
2
+ import { ResolveNotificationRecipientsInputInterface } from '../interfaces/resolve.notification.recipients.input.interface';
3
+ export declare class LoadNotificationPreferenceContext {
4
+ process(request: NotificationPreferenceRequestInterface): Promise<ResolveNotificationRecipientsInputInterface>;
5
+ private isConfigurable;
6
+ private knownRecipients;
7
+ private getBusinessActive;
8
+ private matchUsers;
9
+ private getUserOptOuts;
10
+ }
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LoadNotificationPreferenceContext = void 0;
4
+ const typeorm_1 = require("typeorm");
5
+ const business_notification_type_preference_entity_1 = require("../entities/business.notification.type.preference.entity");
6
+ const business_user_entity_1 = require("../entities/business.user.entity");
7
+ const user_notification_type_preference_entity_1 = require("../entities/user.notification.type.preference.entity");
8
+ const notification_type_control_enum_1 = require("../enums/notification.type.control.enum");
9
+ const notification_type_catalogue_1 = require("./notification.type.catalogue");
10
+ class LoadNotificationPreferenceContext {
11
+ async process(request) {
12
+ const { channel, business_id } = request;
13
+ const type = await new notification_type_catalogue_1.NotificationTypeCatalogue().find(request.identifiers);
14
+ const context = {
15
+ type,
16
+ channel,
17
+ businessActive: null,
18
+ recipients: this.knownRecipients(request),
19
+ userOptOuts: new Set(),
20
+ };
21
+ if (!business_id || !this.isConfigurable(type, request))
22
+ return context;
23
+ const businessActive = await this.getBusinessActive(business_id, type.id, request);
24
+ if (businessActive === false)
25
+ return { ...context, businessActive };
26
+ const recipients = await this.matchUsers(business_id, request);
27
+ const userOptOuts = await this.getUserOptOuts(business_id, type.id, request, recipients);
28
+ return { ...context, businessActive, recipients, userOptOuts };
29
+ }
30
+ isConfigurable(type, request) {
31
+ if (!type || type.active === false)
32
+ return false;
33
+ if (type.control === notification_type_control_enum_1.NotificationTypeControlEnum.LOCKED)
34
+ return false;
35
+ return (type.channels || []).includes(request.channel);
36
+ }
37
+ knownRecipients(request) {
38
+ return (request.recipients || []).map((r) => ({ address: r.address, role: r.role, user_ids: r.user_id ? [r.user_id] : [] }));
39
+ }
40
+ async getBusinessActive(businessId, typeId, request) {
41
+ const row = await business_notification_type_preference_entity_1.BusinessNotificationTypePreferenceEntity.findOne({
42
+ where: { business_id: businessId, notification_type_id: typeId, channel_id: request.channel },
43
+ });
44
+ if (!row)
45
+ return null;
46
+ return row.active;
47
+ }
48
+ async matchUsers(businessId, request) {
49
+ const recipients = this.knownRecipients(request);
50
+ const addresses = [...new Set(recipients.filter((r) => !r.user_ids.length).map((r) => r.address.trim().toLowerCase()))];
51
+ if (!addresses.length)
52
+ return recipients;
53
+ const rows = await business_user_entity_1.BusinessUserEntity.query(`select distinct lower(u.email) as email, u.id as user_id
54
+ from bz_business_users bu
55
+ join sys_users u on u.id = bu.user_id and u.deleted_at is null
56
+ where bu.business_id = $1 and bu.active = true and bu.deleted_at is null
57
+ and lower(u.email) = any($2)`, [businessId, addresses]);
58
+ const byAddress = new Map();
59
+ for (const row of rows || [])
60
+ byAddress.set(row.email, [...(byAddress.get(row.email) || []), Number(row.user_id)]);
61
+ return recipients.map((r) => {
62
+ if (r.user_ids.length)
63
+ return r;
64
+ return { ...r, user_ids: byAddress.get(r.address.trim().toLowerCase()) || [] };
65
+ });
66
+ }
67
+ async getUserOptOuts(businessId, typeId, request, recipients) {
68
+ const userIds = [...new Set(recipients.flatMap((r) => r.user_ids))];
69
+ if (!userIds.length)
70
+ return new Set();
71
+ const rows = await user_notification_type_preference_entity_1.UserNotificationTypePreferenceEntity.find({
72
+ where: { business_id: businessId, notification_type_id: typeId, channel_id: request.channel, active: false, user_id: (0, typeorm_1.In)(userIds) },
73
+ });
74
+ return new Set((rows || []).map((r) => Number(r.user_id)));
75
+ }
76
+ }
77
+ exports.LoadNotificationPreferenceContext = LoadNotificationPreferenceContext;
78
+ //# sourceMappingURL=load.notification.preference.context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load.notification.preference.context.js","sourceRoot":"","sources":["../../../src/access/libraries/load.notification.preference.context.ts"],"names":[],"mappings":";;;AAAA,qCAA6B;AAC7B,2HAAoH;AACpH,2EAAsE;AACtE,mHAA4G;AAC5G,4FAAsF;AAKtF,+EAA0E;AAS1E,MAAa,iCAAiC;IAS1C,KAAK,CAAC,OAAO,CAAC,OAA+C;QACzD,MAAM,EAAE,OAAO,EAAE,WA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AI,GAAG,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC/D,CAAC;CACJ;AA1HD,8EA0HC"}
@@ -0,0 +1,12 @@
1
+ import { CataloguedNotificationTypeInterface } from '../interfaces/catalogued.notification.type.interface';
2
+ import { NotificationSendIdentifiersInterface } from '../interfaces/notification.send.identifiers.interface';
3
+ export declare class NotificationTypeCatalogue {
4
+ static readonly TTL: number;
5
+ private static loading;
6
+ private static loadedAt;
7
+ static clear(): void;
8
+ find(identifiers: NotificationSendIdentifiersInterface): Promise<CataloguedNotificationTypeInterface | null>;
9
+ private getIndex;
10
+ private load;
11
+ private add;
12
+ }