@open-mercato/core 0.4.2-canary-15c0b23a3a → 0.4.2-canary-da2b080494

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 (433) hide show
  1. package/dist/generated/entities.ids.generated.js +1 -5
  2. package/dist/generated/entities.ids.generated.js.map +2 -2
  3. package/dist/generated/entity-fields-registry.js +0 -2
  4. package/dist/generated/entity-fields-registry.js.map +2 -2
  5. package/dist/modules/api_docs/frontend/docs/api/page.js +2 -3
  6. package/dist/modules/api_docs/frontend/docs/api/page.js.map +2 -2
  7. package/dist/modules/api_keys/backend/api-keys/page.js +1 -1
  8. package/dist/modules/api_keys/backend/api-keys/page.js.map +2 -2
  9. package/dist/modules/attachments/components/AttachmentLibrary.js +0 -4
  10. package/dist/modules/attachments/components/AttachmentLibrary.js.map +2 -2
  11. package/dist/modules/attachments/components/AttachmentPartitionSettings.js +0 -2
  12. package/dist/modules/attachments/components/AttachmentPartitionSettings.js.map +2 -2
  13. package/dist/modules/auth/api/admin/nav.js +3 -4
  14. package/dist/modules/auth/api/admin/nav.js.map +2 -2
  15. package/dist/modules/auth/api/reset/confirm.js +2 -25
  16. package/dist/modules/auth/api/reset/confirm.js.map +2 -2
  17. package/dist/modules/auth/api/reset.js +0 -23
  18. package/dist/modules/auth/api/reset.js.map +2 -2
  19. package/dist/modules/auth/api/sidebar/preferences/route.js +9 -14
  20. package/dist/modules/auth/api/sidebar/preferences/route.js.map +2 -2
  21. package/dist/modules/auth/api/users/route.js +2 -4
  22. package/dist/modules/auth/api/users/route.js.map +2 -2
  23. package/dist/modules/auth/backend/roles/[id]/edit/page.js +1 -4
  24. package/dist/modules/auth/backend/roles/[id]/edit/page.js.map +2 -2
  25. package/dist/modules/auth/backend/roles/page.js +3 -3
  26. package/dist/modules/auth/backend/roles/page.js.map +2 -2
  27. package/dist/modules/auth/backend/users/[id]/edit/page.js +3 -18
  28. package/dist/modules/auth/backend/users/[id]/edit/page.js.map +2 -2
  29. package/dist/modules/auth/backend/users/create/page.js +2 -15
  30. package/dist/modules/auth/backend/users/create/page.js.map +2 -2
  31. package/dist/modules/auth/backend/users/page.js +3 -3
  32. package/dist/modules/auth/backend/users/page.js.map +2 -2
  33. package/dist/modules/auth/cli.js +11 -25
  34. package/dist/modules/auth/cli.js.map +2 -2
  35. package/dist/modules/auth/commands/users.js +2 -59
  36. package/dist/modules/auth/commands/users.js.map +2 -2
  37. package/dist/modules/auth/data/validators.js +2 -4
  38. package/dist/modules/auth/data/validators.js.map +2 -2
  39. package/dist/modules/auth/frontend/reset/[token]/page.js +10 -20
  40. package/dist/modules/auth/frontend/reset/[token]/page.js.map +2 -2
  41. package/dist/modules/auth/lib/setup-app.js +0 -1
  42. package/dist/modules/auth/lib/setup-app.js.map +2 -2
  43. package/dist/modules/auth/services/authService.js +3 -3
  44. package/dist/modules/auth/services/authService.js.map +2 -2
  45. package/dist/modules/business_rules/api/execute/route.js +1 -7
  46. package/dist/modules/business_rules/api/execute/route.js.map +2 -2
  47. package/dist/modules/business_rules/backend/rules/page.js +0 -4
  48. package/dist/modules/business_rules/backend/rules/page.js.map +2 -2
  49. package/dist/modules/business_rules/backend/sets/page.js +0 -3
  50. package/dist/modules/business_rules/backend/sets/page.js.map +2 -2
  51. package/dist/modules/business_rules/lib/rule-engine.js +3 -33
  52. package/dist/modules/business_rules/lib/rule-engine.js.map +2 -2
  53. package/dist/modules/catalog/components/PriceKindSettings.js +0 -2
  54. package/dist/modules/catalog/components/PriceKindSettings.js.map +2 -2
  55. package/dist/modules/catalog/components/categories/CategoriesDataTable.js +2 -2
  56. package/dist/modules/catalog/components/categories/CategoriesDataTable.js.map +2 -2
  57. package/dist/modules/catalog/components/products/ProductsDataTable.js +0 -2
  58. package/dist/modules/catalog/components/products/ProductsDataTable.js.map +2 -2
  59. package/dist/modules/configs/cli.js +0 -6
  60. package/dist/modules/configs/cli.js.map +2 -2
  61. package/dist/modules/configs/components/CachePanel.js +4 -4
  62. package/dist/modules/configs/components/CachePanel.js.map +2 -2
  63. package/dist/modules/configs/lib/system-status.js +1 -48
  64. package/dist/modules/configs/lib/system-status.js.map +2 -2
  65. package/dist/modules/configs/lib/upgrade-actions.js +0 -18
  66. package/dist/modules/configs/lib/upgrade-actions.js.map +2 -2
  67. package/dist/modules/currencies/backend/currencies/page.js +0 -3
  68. package/dist/modules/currencies/backend/currencies/page.js.map +2 -2
  69. package/dist/modules/currencies/backend/exchange-rates/page.js +0 -2
  70. package/dist/modules/currencies/backend/exchange-rates/page.js.map +2 -2
  71. package/dist/modules/customers/backend/customers/companies/page.js +0 -3
  72. package/dist/modules/customers/backend/customers/companies/page.js.map +2 -2
  73. package/dist/modules/customers/backend/customers/deals/page.js +0 -3
  74. package/dist/modules/customers/backend/customers/deals/page.js.map +2 -2
  75. package/dist/modules/customers/backend/customers/people/page.js +0 -3
  76. package/dist/modules/customers/backend/customers/people/page.js.map +2 -2
  77. package/dist/modules/customers/commands/deals.js +0 -31
  78. package/dist/modules/customers/commands/deals.js.map +2 -2
  79. package/dist/modules/customers/components/CustomerTodosTable.js +0 -1
  80. package/dist/modules/customers/components/CustomerTodosTable.js.map +2 -2
  81. package/dist/modules/dashboards/cli.js +5 -44
  82. package/dist/modules/dashboards/cli.js.map +2 -2
  83. package/dist/modules/dashboards/components/WidgetVisibilityEditor.js +11 -16
  84. package/dist/modules/dashboards/components/WidgetVisibilityEditor.js.map +3 -3
  85. package/dist/modules/dashboards/services/widgetDataService.js +3 -132
  86. package/dist/modules/dashboards/services/widgetDataService.js.map +2 -2
  87. package/dist/modules/dictionaries/components/DictionaryTable.js +0 -2
  88. package/dist/modules/dictionaries/components/DictionaryTable.js.map +2 -2
  89. package/dist/modules/directory/backend/directory/organizations/page.js +2 -2
  90. package/dist/modules/directory/backend/directory/organizations/page.js.map +2 -2
  91. package/dist/modules/directory/backend/directory/tenants/page.js +2 -2
  92. package/dist/modules/directory/backend/directory/tenants/page.js.map +2 -2
  93. package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js +2 -2
  94. package/dist/modules/entities/backend/entities/user/[entityId]/records/page.js.map +2 -2
  95. package/dist/modules/entities/components/SystemEntitiesTable.js +1 -1
  96. package/dist/modules/entities/components/SystemEntitiesTable.js.map +2 -2
  97. package/dist/modules/entities/components/UserEntitiesTable.js +2 -2
  98. package/dist/modules/entities/components/UserEntitiesTable.js.map +2 -2
  99. package/dist/modules/feature_toggles/components/FeatureTogglesTable.js +3 -3
  100. package/dist/modules/feature_toggles/components/FeatureTogglesTable.js.map +2 -2
  101. package/dist/modules/feature_toggles/components/OverridesTable.js +1 -1
  102. package/dist/modules/feature_toggles/components/OverridesTable.js.map +2 -2
  103. package/dist/modules/planner/backend/planner/availability-rulesets/page.js +2 -2
  104. package/dist/modules/planner/backend/planner/availability-rulesets/page.js.map +2 -2
  105. package/dist/modules/query_index/components/QueryIndexesTable.js +1 -7
  106. package/dist/modules/query_index/components/QueryIndexesTable.js.map +2 -2
  107. package/dist/modules/resources/backend/resources/resource-types/page.js +2 -2
  108. package/dist/modules/resources/backend/resources/resource-types/page.js.map +2 -2
  109. package/dist/modules/resources/backend/resources/resources/page.js +2 -2
  110. package/dist/modules/resources/backend/resources/resources/page.js.map +2 -2
  111. package/dist/modules/sales/backend/sales/channels/offers/page.js +0 -2
  112. package/dist/modules/sales/backend/sales/channels/offers/page.js.map +2 -2
  113. package/dist/modules/sales/backend/sales/channels/page.js +0 -2
  114. package/dist/modules/sales/backend/sales/channels/page.js.map +2 -2
  115. package/dist/modules/sales/commands/documents.js +0 -53
  116. package/dist/modules/sales/commands/documents.js.map +2 -2
  117. package/dist/modules/sales/commands/payments.js +0 -26
  118. package/dist/modules/sales/commands/payments.js.map +2 -2
  119. package/dist/modules/sales/components/AdjustmentKindSettings.js +2 -2
  120. package/dist/modules/sales/components/AdjustmentKindSettings.js.map +2 -2
  121. package/dist/modules/sales/components/PaymentMethodsSettings.js +2 -2
  122. package/dist/modules/sales/components/PaymentMethodsSettings.js.map +2 -2
  123. package/dist/modules/sales/components/ShippingMethodsSettings.js +2 -2
  124. package/dist/modules/sales/components/ShippingMethodsSettings.js.map +2 -2
  125. package/dist/modules/sales/components/TaxRatesSettings.js +2 -2
  126. package/dist/modules/sales/components/TaxRatesSettings.js.map +2 -2
  127. package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js +0 -2
  128. package/dist/modules/sales/components/channels/SalesChannelOffersPanel.js.map +2 -2
  129. package/dist/modules/sales/components/documents/AdjustmentsSection.js +0 -2
  130. package/dist/modules/sales/components/documents/AdjustmentsSection.js.map +2 -2
  131. package/dist/modules/sales/components/documents/PaymentsSection.js +1 -2
  132. package/dist/modules/sales/components/documents/PaymentsSection.js.map +2 -2
  133. package/dist/modules/sales/components/documents/SalesDocumentsTable.js +0 -2
  134. package/dist/modules/sales/components/documents/SalesDocumentsTable.js.map +2 -2
  135. package/dist/modules/staff/backend/staff/team-members/page.js +1 -1
  136. package/dist/modules/staff/backend/staff/team-members/page.js.map +2 -2
  137. package/dist/modules/staff/backend/staff/team-roles/page.js +2 -2
  138. package/dist/modules/staff/backend/staff/team-roles/page.js.map +2 -2
  139. package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js +2 -2
  140. package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js.map +2 -2
  141. package/dist/modules/staff/backend/staff/teams/page.js +2 -2
  142. package/dist/modules/staff/backend/staff/teams/page.js.map +2 -2
  143. package/dist/modules/staff/commands/leave-requests.js +0 -79
  144. package/dist/modules/staff/commands/leave-requests.js.map +2 -2
  145. package/dist/modules/workflows/backend/definitions/page.js +0 -5
  146. package/dist/modules/workflows/backend/definitions/page.js.map +2 -2
  147. package/dist/modules/workflows/backend/instances/page.js +0 -3
  148. package/dist/modules/workflows/backend/instances/page.js.map +2 -2
  149. package/dist/modules/workflows/backend/tasks/page.js +0 -3
  150. package/dist/modules/workflows/backend/tasks/page.js.map +2 -2
  151. package/dist/modules/workflows/lib/transition-handler.js +6 -14
  152. package/dist/modules/workflows/lib/transition-handler.js.map +2 -2
  153. package/generated/entities.ids.generated.ts +1 -5
  154. package/generated/entity-fields-registry.ts +0 -2
  155. package/package.json +2 -2
  156. package/src/modules/api_docs/frontend/docs/api/page.tsx +2 -3
  157. package/src/modules/api_keys/backend/api-keys/page.tsx +1 -1
  158. package/src/modules/attachments/components/AttachmentLibrary.tsx +0 -4
  159. package/src/modules/attachments/components/AttachmentPartitionSettings.tsx +0 -2
  160. package/src/modules/auth/README.md +1 -1
  161. package/src/modules/auth/__tests__/cli-setup-acl.test.ts +1 -1
  162. package/src/modules/auth/api/admin/nav.ts +6 -10
  163. package/src/modules/auth/api/reset/confirm.ts +2 -25
  164. package/src/modules/auth/api/reset.ts +0 -23
  165. package/src/modules/auth/api/sidebar/preferences/route.ts +12 -21
  166. package/src/modules/auth/api/users/route.ts +2 -5
  167. package/src/modules/auth/backend/roles/[id]/edit/page.tsx +1 -4
  168. package/src/modules/auth/backend/roles/page.tsx +3 -3
  169. package/src/modules/auth/backend/users/[id]/edit/page.tsx +3 -22
  170. package/src/modules/auth/backend/users/create/page.tsx +2 -19
  171. package/src/modules/auth/backend/users/page.tsx +3 -3
  172. package/src/modules/auth/cli.ts +11 -38
  173. package/src/modules/auth/commands/users.ts +2 -73
  174. package/src/modules/auth/data/validators.ts +2 -5
  175. package/src/modules/auth/frontend/reset/[token]/page.tsx +11 -24
  176. package/src/modules/auth/i18n/de.json +1 -43
  177. package/src/modules/auth/i18n/en.json +1 -43
  178. package/src/modules/auth/i18n/es.json +1 -43
  179. package/src/modules/auth/i18n/pl.json +1 -43
  180. package/src/modules/auth/lib/setup-app.ts +0 -1
  181. package/src/modules/auth/services/authService.ts +4 -4
  182. package/src/modules/business_rules/api/execute/route.ts +1 -8
  183. package/src/modules/business_rules/backend/rules/page.tsx +0 -4
  184. package/src/modules/business_rules/backend/sets/page.tsx +0 -3
  185. package/src/modules/business_rules/i18n/en.json +1 -3
  186. package/src/modules/business_rules/lib/__tests__/rule-engine.test.ts +0 -51
  187. package/src/modules/business_rules/lib/rule-engine.ts +3 -57
  188. package/src/modules/catalog/components/PriceKindSettings.tsx +0 -2
  189. package/src/modules/catalog/components/categories/CategoriesDataTable.tsx +2 -2
  190. package/src/modules/catalog/components/products/ProductsDataTable.tsx +0 -2
  191. package/src/modules/catalog/i18n/en.json +1 -3
  192. package/src/modules/configs/cli.ts +0 -6
  193. package/src/modules/configs/components/CachePanel.tsx +4 -4
  194. package/src/modules/configs/i18n/en.json +2 -12
  195. package/src/modules/configs/i18n/pl.json +2 -12
  196. package/src/modules/configs/lib/system-status.ts +1 -48
  197. package/src/modules/configs/lib/system-status.types.ts +0 -1
  198. package/src/modules/configs/lib/upgrade-actions.ts +0 -18
  199. package/src/modules/currencies/backend/currencies/page.tsx +0 -3
  200. package/src/modules/currencies/backend/exchange-rates/page.tsx +0 -2
  201. package/src/modules/customers/backend/customers/companies/page.tsx +0 -3
  202. package/src/modules/customers/backend/customers/deals/page.tsx +0 -3
  203. package/src/modules/customers/backend/customers/people/page.tsx +0 -3
  204. package/src/modules/customers/commands/deals.ts +0 -39
  205. package/src/modules/customers/components/CustomerTodosTable.tsx +0 -1
  206. package/src/modules/customers/i18n/en.json +1 -5
  207. package/src/modules/dashboards/cli.ts +5 -55
  208. package/src/modules/dashboards/components/WidgetVisibilityEditor.tsx +11 -22
  209. package/src/modules/dashboards/services/widgetDataService.ts +4 -157
  210. package/src/modules/dictionaries/components/DictionaryTable.tsx +0 -2
  211. package/src/modules/directory/backend/directory/organizations/page.tsx +2 -2
  212. package/src/modules/directory/backend/directory/tenants/page.tsx +2 -2
  213. package/src/modules/entities/backend/entities/user/[entityId]/records/page.tsx +2 -2
  214. package/src/modules/entities/components/SystemEntitiesTable.tsx +1 -1
  215. package/src/modules/entities/components/UserEntitiesTable.tsx +2 -2
  216. package/src/modules/feature_toggles/components/FeatureTogglesTable.tsx +4 -3
  217. package/src/modules/feature_toggles/components/OverridesTable.tsx +1 -1
  218. package/src/modules/planner/backend/planner/availability-rulesets/page.tsx +2 -2
  219. package/src/modules/query_index/components/QueryIndexesTable.tsx +2 -8
  220. package/src/modules/resources/backend/resources/resource-types/page.tsx +2 -2
  221. package/src/modules/resources/backend/resources/resources/page.tsx +2 -2
  222. package/src/modules/sales/backend/sales/channels/offers/page.tsx +0 -2
  223. package/src/modules/sales/backend/sales/channels/page.tsx +0 -2
  224. package/src/modules/sales/commands/documents.ts +0 -65
  225. package/src/modules/sales/commands/payments.ts +0 -33
  226. package/src/modules/sales/components/AdjustmentKindSettings.tsx +2 -2
  227. package/src/modules/sales/components/PaymentMethodsSettings.tsx +2 -2
  228. package/src/modules/sales/components/ShippingMethodsSettings.tsx +2 -2
  229. package/src/modules/sales/components/TaxRatesSettings.tsx +2 -2
  230. package/src/modules/sales/components/channels/SalesChannelOffersPanel.tsx +0 -2
  231. package/src/modules/sales/components/documents/AdjustmentsSection.tsx +0 -2
  232. package/src/modules/sales/components/documents/PaymentsSection.tsx +1 -2
  233. package/src/modules/sales/components/documents/SalesDocumentsTable.tsx +0 -2
  234. package/src/modules/sales/i18n/de.json +0 -20
  235. package/src/modules/sales/i18n/en.json +1 -25
  236. package/src/modules/sales/i18n/es.json +0 -20
  237. package/src/modules/sales/i18n/pl.json +0 -20
  238. package/src/modules/staff/backend/staff/team-members/page.tsx +1 -1
  239. package/src/modules/staff/backend/staff/team-roles/page.tsx +2 -2
  240. package/src/modules/staff/backend/staff/teams/[id]/edit/page.tsx +2 -2
  241. package/src/modules/staff/backend/staff/teams/page.tsx +2 -2
  242. package/src/modules/staff/commands/leave-requests.ts +0 -94
  243. package/src/modules/staff/i18n/de.json +0 -4
  244. package/src/modules/staff/i18n/en.json +1 -9
  245. package/src/modules/staff/i18n/es.json +0 -4
  246. package/src/modules/staff/i18n/pl.json +0 -4
  247. package/src/modules/workflows/backend/definitions/page.tsx +0 -5
  248. package/src/modules/workflows/backend/instances/page.tsx +1 -4
  249. package/src/modules/workflows/backend/tasks/page.tsx +1 -4
  250. package/src/modules/workflows/i18n/en.json +1 -3
  251. package/src/modules/workflows/lib/transition-handler.ts +6 -18
  252. package/dist/generated/entities/notification/index.js +0 -57
  253. package/dist/generated/entities/notification/index.js.map +0 -7
  254. package/dist/modules/auth/api/profile/route.js +0 -157
  255. package/dist/modules/auth/api/profile/route.js.map +0 -7
  256. package/dist/modules/auth/backend/auth/profile/page.js +0 -141
  257. package/dist/modules/auth/backend/auth/profile/page.js.map +0 -7
  258. package/dist/modules/auth/backend/auth/profile/page.meta.js +0 -13
  259. package/dist/modules/auth/backend/auth/profile/page.meta.js.map +0 -7
  260. package/dist/modules/auth/notifications.js +0 -112
  261. package/dist/modules/auth/notifications.js.map +0 -7
  262. package/dist/modules/business_rules/notifications.js +0 -28
  263. package/dist/modules/business_rules/notifications.js.map +0 -7
  264. package/dist/modules/business_rules/subscribers/rule-execution-failed-notification.js +0 -37
  265. package/dist/modules/business_rules/subscribers/rule-execution-failed-notification.js.map +0 -7
  266. package/dist/modules/catalog/notifications.js +0 -28
  267. package/dist/modules/catalog/notifications.js.map +0 -7
  268. package/dist/modules/catalog/subscribers/low-stock-notification.js +0 -38
  269. package/dist/modules/catalog/subscribers/low-stock-notification.js.map +0 -7
  270. package/dist/modules/customers/notifications.js +0 -48
  271. package/dist/modules/customers/notifications.js.map +0 -7
  272. package/dist/modules/dashboards/lib/role-widgets.js +0 -58
  273. package/dist/modules/dashboards/lib/role-widgets.js.map +0 -7
  274. package/dist/modules/notifications/acl.js +0 -11
  275. package/dist/modules/notifications/acl.js.map +0 -7
  276. package/dist/modules/notifications/api/[id]/action/route.js +0 -74
  277. package/dist/modules/notifications/api/[id]/action/route.js.map +0 -7
  278. package/dist/modules/notifications/api/[id]/dismiss/route.js +0 -15
  279. package/dist/modules/notifications/api/[id]/dismiss/route.js.map +0 -7
  280. package/dist/modules/notifications/api/[id]/read/route.js +0 -15
  281. package/dist/modules/notifications/api/[id]/read/route.js.map +0 -7
  282. package/dist/modules/notifications/api/[id]/restore/route.js +0 -53
  283. package/dist/modules/notifications/api/[id]/restore/route.js.map +0 -7
  284. package/dist/modules/notifications/api/batch/route.js +0 -17
  285. package/dist/modules/notifications/api/batch/route.js.map +0 -7
  286. package/dist/modules/notifications/api/feature/route.js +0 -17
  287. package/dist/modules/notifications/api/feature/route.js.map +0 -7
  288. package/dist/modules/notifications/api/mark-all-read/route.js +0 -35
  289. package/dist/modules/notifications/api/mark-all-read/route.js.map +0 -7
  290. package/dist/modules/notifications/api/openapi.js +0 -76
  291. package/dist/modules/notifications/api/openapi.js.map +0 -7
  292. package/dist/modules/notifications/api/role/route.js +0 -17
  293. package/dist/modules/notifications/api/role/route.js.map +0 -7
  294. package/dist/modules/notifications/api/route.js +0 -85
  295. package/dist/modules/notifications/api/route.js.map +0 -7
  296. package/dist/modules/notifications/api/settings/route.js +0 -155
  297. package/dist/modules/notifications/api/settings/route.js.map +0 -7
  298. package/dist/modules/notifications/api/unread-count/route.js +0 -38
  299. package/dist/modules/notifications/api/unread-count/route.js.map +0 -7
  300. package/dist/modules/notifications/backend/config/notifications/page.js +0 -10
  301. package/dist/modules/notifications/backend/config/notifications/page.js.map +0 -7
  302. package/dist/modules/notifications/backend/config/notifications/page.meta.js +0 -24
  303. package/dist/modules/notifications/backend/config/notifications/page.meta.js.map +0 -7
  304. package/dist/modules/notifications/cli.js +0 -16
  305. package/dist/modules/notifications/cli.js.map +0 -7
  306. package/dist/modules/notifications/data/entities.js +0 -112
  307. package/dist/modules/notifications/data/entities.js.map +0 -7
  308. package/dist/modules/notifications/data/validators.js +0 -98
  309. package/dist/modules/notifications/data/validators.js.map +0 -7
  310. package/dist/modules/notifications/di.js +0 -13
  311. package/dist/modules/notifications/di.js.map +0 -7
  312. package/dist/modules/notifications/emails/NotificationEmail.js +0 -58
  313. package/dist/modules/notifications/emails/NotificationEmail.js.map +0 -7
  314. package/dist/modules/notifications/frontend/NotificationInboxPageClient.js +0 -44
  315. package/dist/modules/notifications/frontend/NotificationInboxPageClient.js.map +0 -7
  316. package/dist/modules/notifications/frontend/NotificationSettingsPageClient.js +0 -220
  317. package/dist/modules/notifications/frontend/NotificationSettingsPageClient.js.map +0 -7
  318. package/dist/modules/notifications/index.js +0 -14
  319. package/dist/modules/notifications/index.js.map +0 -7
  320. package/dist/modules/notifications/lib/deliveryConfig.js +0 -107
  321. package/dist/modules/notifications/lib/deliveryConfig.js.map +0 -7
  322. package/dist/modules/notifications/lib/deliveryStrategies.js +0 -14
  323. package/dist/modules/notifications/lib/deliveryStrategies.js.map +0 -7
  324. package/dist/modules/notifications/lib/events.js +0 -12
  325. package/dist/modules/notifications/lib/events.js.map +0 -7
  326. package/dist/modules/notifications/lib/notificationBuilder.js +0 -66
  327. package/dist/modules/notifications/lib/notificationBuilder.js.map +0 -7
  328. package/dist/modules/notifications/lib/notificationFactory.js +0 -54
  329. package/dist/modules/notifications/lib/notificationFactory.js.map +0 -7
  330. package/dist/modules/notifications/lib/notificationMapper.js +0 -34
  331. package/dist/modules/notifications/lib/notificationMapper.js.map +0 -7
  332. package/dist/modules/notifications/lib/notificationRecipients.js +0 -35
  333. package/dist/modules/notifications/lib/notificationRecipients.js.map +0 -7
  334. package/dist/modules/notifications/lib/notificationService.js +0 -279
  335. package/dist/modules/notifications/lib/notificationService.js.map +0 -7
  336. package/dist/modules/notifications/lib/routeHelpers.js +0 -101
  337. package/dist/modules/notifications/lib/routeHelpers.js.map +0 -7
  338. package/dist/modules/notifications/lib/safeHref.js +0 -24
  339. package/dist/modules/notifications/lib/safeHref.js.map +0 -7
  340. package/dist/modules/notifications/migrations/Migration20260123000001.js +0 -70
  341. package/dist/modules/notifications/migrations/Migration20260123000001.js.map +0 -7
  342. package/dist/modules/notifications/migrations/Migration20260126150000.js +0 -37
  343. package/dist/modules/notifications/migrations/Migration20260126150000.js.map +0 -7
  344. package/dist/modules/notifications/subscribers/deliver-notification.js +0 -165
  345. package/dist/modules/notifications/subscribers/deliver-notification.js.map +0 -7
  346. package/dist/modules/notifications/workers/create-notification.worker.js +0 -70
  347. package/dist/modules/notifications/workers/create-notification.worker.js.map +0 -7
  348. package/dist/modules/sales/notifications.client.js +0 -51
  349. package/dist/modules/sales/notifications.client.js.map +0 -7
  350. package/dist/modules/sales/notifications.js +0 -88
  351. package/dist/modules/sales/notifications.js.map +0 -7
  352. package/dist/modules/sales/subscribers/quote-expiring-notification.js +0 -38
  353. package/dist/modules/sales/subscribers/quote-expiring-notification.js.map +0 -7
  354. package/dist/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.js +0 -137
  355. package/dist/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.js.map +0 -7
  356. package/dist/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.js +0 -137
  357. package/dist/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.js.map +0 -7
  358. package/dist/modules/sales/widgets/notifications/index.js +0 -7
  359. package/dist/modules/sales/widgets/notifications/index.js.map +0 -7
  360. package/dist/modules/sales/widgets/notifications/useSalesDocumentTotals.js +0 -60
  361. package/dist/modules/sales/widgets/notifications/useSalesDocumentTotals.js.map +0 -7
  362. package/dist/modules/staff/notifications.js +0 -75
  363. package/dist/modules/staff/notifications.js.map +0 -7
  364. package/dist/modules/workflows/notifications.js +0 -28
  365. package/dist/modules/workflows/notifications.js.map +0 -7
  366. package/dist/modules/workflows/subscribers/task-assigned-notification.js +0 -38
  367. package/dist/modules/workflows/subscribers/task-assigned-notification.js.map +0 -7
  368. package/generated/entities/notification/index.ts +0 -27
  369. package/src/modules/auth/api/profile/route.ts +0 -163
  370. package/src/modules/auth/backend/auth/profile/page.meta.ts +0 -9
  371. package/src/modules/auth/backend/auth/profile/page.tsx +0 -174
  372. package/src/modules/auth/notifications.ts +0 -109
  373. package/src/modules/business_rules/notifications.ts +0 -25
  374. package/src/modules/business_rules/subscribers/rule-execution-failed-notification.ts +0 -50
  375. package/src/modules/catalog/notifications.ts +0 -25
  376. package/src/modules/catalog/subscribers/low-stock-notification.ts +0 -52
  377. package/src/modules/customers/notifications.ts +0 -44
  378. package/src/modules/dashboards/lib/role-widgets.ts +0 -80
  379. package/src/modules/notifications/__tests__/deliver-notification.test.ts +0 -195
  380. package/src/modules/notifications/__tests__/deliveryStrategies.test.ts +0 -19
  381. package/src/modules/notifications/__tests__/notificationService.test.ts +0 -208
  382. package/src/modules/notifications/acl.ts +0 -7
  383. package/src/modules/notifications/api/[id]/action/route.ts +0 -75
  384. package/src/modules/notifications/api/[id]/dismiss/route.ts +0 -12
  385. package/src/modules/notifications/api/[id]/read/route.ts +0 -12
  386. package/src/modules/notifications/api/[id]/restore/route.ts +0 -53
  387. package/src/modules/notifications/api/batch/route.ts +0 -14
  388. package/src/modules/notifications/api/feature/route.ts +0 -14
  389. package/src/modules/notifications/api/mark-all-read/route.ts +0 -34
  390. package/src/modules/notifications/api/openapi.ts +0 -76
  391. package/src/modules/notifications/api/role/route.ts +0 -14
  392. package/src/modules/notifications/api/route.ts +0 -92
  393. package/src/modules/notifications/api/settings/route.ts +0 -157
  394. package/src/modules/notifications/api/unread-count/route.ts +0 -38
  395. package/src/modules/notifications/backend/config/notifications/page.meta.ts +0 -22
  396. package/src/modules/notifications/backend/config/notifications/page.tsx +0 -12
  397. package/src/modules/notifications/cli.ts +0 -18
  398. package/src/modules/notifications/data/entities.ts +0 -99
  399. package/src/modules/notifications/data/validators.ts +0 -115
  400. package/src/modules/notifications/di.ts +0 -11
  401. package/src/modules/notifications/emails/NotificationEmail.tsx +0 -98
  402. package/src/modules/notifications/frontend/NotificationInboxPageClient.tsx +0 -42
  403. package/src/modules/notifications/frontend/NotificationSettingsPageClient.tsx +0 -233
  404. package/src/modules/notifications/i18n/de.json +0 -50
  405. package/src/modules/notifications/i18n/en.json +0 -50
  406. package/src/modules/notifications/i18n/es.json +0 -50
  407. package/src/modules/notifications/i18n/pl.json +0 -50
  408. package/src/modules/notifications/index.ts +0 -12
  409. package/src/modules/notifications/lib/deliveryConfig.ts +0 -153
  410. package/src/modules/notifications/lib/deliveryStrategies.ts +0 -50
  411. package/src/modules/notifications/lib/events.ts +0 -48
  412. package/src/modules/notifications/lib/notificationBuilder.ts +0 -121
  413. package/src/modules/notifications/lib/notificationFactory.ts +0 -76
  414. package/src/modules/notifications/lib/notificationMapper.ts +0 -33
  415. package/src/modules/notifications/lib/notificationRecipients.ts +0 -83
  416. package/src/modules/notifications/lib/notificationService.ts +0 -414
  417. package/src/modules/notifications/lib/routeHelpers.ts +0 -151
  418. package/src/modules/notifications/lib/safeHref.ts +0 -29
  419. package/src/modules/notifications/migrations/.snapshot-open-mercato.json +0 -300
  420. package/src/modules/notifications/migrations/Migration20260123000001.ts +0 -73
  421. package/src/modules/notifications/migrations/Migration20260126150000.ts +0 -39
  422. package/src/modules/notifications/subscribers/deliver-notification.ts +0 -204
  423. package/src/modules/notifications/workers/create-notification.worker.ts +0 -122
  424. package/src/modules/sales/notifications.client.ts +0 -65
  425. package/src/modules/sales/notifications.ts +0 -82
  426. package/src/modules/sales/subscribers/quote-expiring-notification.ts +0 -53
  427. package/src/modules/sales/widgets/notifications/SalesOrderCreatedRenderer.tsx +0 -156
  428. package/src/modules/sales/widgets/notifications/SalesQuoteCreatedRenderer.tsx +0 -156
  429. package/src/modules/sales/widgets/notifications/index.ts +0 -2
  430. package/src/modules/sales/widgets/notifications/useSalesDocumentTotals.ts +0 -81
  431. package/src/modules/staff/notifications.ts +0 -71
  432. package/src/modules/workflows/notifications.ts +0 -25
  433. package/src/modules/workflows/subscribers/task-assigned-notification.ts +0 -53
@@ -1,12 +0,0 @@
1
- const NOTIFICATION_EVENTS = {
2
- CREATED: "notifications.created",
3
- READ: "notifications.read",
4
- ACTIONED: "notifications.actioned",
5
- DISMISSED: "notifications.dismissed",
6
- RESTORED: "notifications.restored",
7
- EXPIRED: "notifications.expired"
8
- };
9
- export {
10
- NOTIFICATION_EVENTS
11
- };
12
- //# sourceMappingURL=events.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/modules/notifications/lib/events.ts"],
4
- "sourcesContent": ["export const NOTIFICATION_EVENTS = {\n CREATED: 'notifications.created',\n READ: 'notifications.read',\n ACTIONED: 'notifications.actioned',\n DISMISSED: 'notifications.dismissed',\n RESTORED: 'notifications.restored',\n EXPIRED: 'notifications.expired',\n} as const\n\nexport type NotificationCreatedPayload = {\n notificationId: string\n recipientUserId: string\n type: string\n title: string\n tenantId: string\n organizationId?: string | null\n}\n\nexport type NotificationReadPayload = {\n notificationId: string\n userId: string\n tenantId: string\n}\n\nexport type NotificationActionedPayload = {\n notificationId: string\n actionId: string\n userId: string\n tenantId: string\n}\n\nexport type NotificationDismissedPayload = {\n notificationId: string\n userId: string\n tenantId: string\n}\n\nexport type NotificationRestoredPayload = {\n notificationId: string\n userId: string\n tenantId: string\n status: 'read' | 'unread'\n}\n\nexport type NotificationExpiredPayload = {\n notificationIds: string[]\n tenantId: string\n}\n"],
5
- "mappings": "AAAO,MAAM,sBAAsB;AAAA,EACjC,SAAS;AAAA,EACT,MAAM;AAAA,EACN,UAAU;AAAA,EACV,WAAW;AAAA,EACX,UAAU;AAAA,EACV,SAAS;AACX;",
6
- "names": []
7
- }
@@ -1,66 +0,0 @@
1
- function mapActions(actions) {
2
- if (!actions || actions.length === 0) return void 0;
3
- return actions.map((action) => ({
4
- id: action.id,
5
- label: action.labelKey,
6
- labelKey: action.labelKey,
7
- variant: action.variant,
8
- icon: action.icon,
9
- commandId: action.commandId,
10
- href: action.href,
11
- confirmRequired: action.confirmRequired,
12
- confirmMessage: action.confirmMessageKey
13
- }));
14
- }
15
- function buildBaseNotificationFields(typeDef, options) {
16
- return {
17
- type: typeDef.type,
18
- titleKey: typeDef.titleKey,
19
- bodyKey: typeDef.bodyKey,
20
- titleVariables: options.titleVariables,
21
- bodyVariables: options.bodyVariables,
22
- title: typeDef.titleKey,
23
- body: typeDef.bodyKey,
24
- icon: typeDef.icon,
25
- severity: typeDef.severity,
26
- actions: mapActions(typeDef.actions),
27
- primaryActionId: typeDef.primaryActionId,
28
- sourceModule: typeDef.module,
29
- sourceEntityType: options.sourceEntityType,
30
- sourceEntityId: options.sourceEntityId,
31
- linkHref: options.linkHref ?? typeDef.linkHref,
32
- groupKey: options.groupKey,
33
- expiresAt: options.expiresAt ?? (typeDef.expiresAfterHours ? new Date(Date.now() + typeDef.expiresAfterHours * 60 * 60 * 1e3).toISOString() : void 0)
34
- };
35
- }
36
- function buildNotificationFromType(typeDef, options) {
37
- return {
38
- recipientUserId: options.recipientUserId,
39
- ...buildBaseNotificationFields(typeDef, options)
40
- };
41
- }
42
- function buildBatchNotificationFromType(typeDef, options) {
43
- return {
44
- recipientUserIds: options.recipientUserIds,
45
- ...buildBaseNotificationFields(typeDef, options)
46
- };
47
- }
48
- function buildRoleNotificationFromType(typeDef, options) {
49
- return {
50
- roleId: options.roleId,
51
- ...buildBaseNotificationFields(typeDef, options)
52
- };
53
- }
54
- function buildFeatureNotificationFromType(typeDef, options) {
55
- return {
56
- requiredFeature: options.requiredFeature,
57
- ...buildBaseNotificationFields(typeDef, options)
58
- };
59
- }
60
- export {
61
- buildBatchNotificationFromType,
62
- buildFeatureNotificationFromType,
63
- buildNotificationFromType,
64
- buildRoleNotificationFromType
65
- };
66
- //# sourceMappingURL=notificationBuilder.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/modules/notifications/lib/notificationBuilder.ts"],
4
- "sourcesContent": ["import type { NotificationTypeDefinition, NotificationTypeAction } from '@open-mercato/shared/modules/notifications/types'\nimport type { CreateNotificationInput, CreateBatchNotificationInput, CreateRoleNotificationInput, CreateFeatureNotificationInput } from '../data/validators'\n\n/**\n * Transform type definition actions to API input actions.\n * Type definitions use labelKey (i18n-first), while API input uses label with optional labelKey.\n */\nfunction mapActions(actions: NotificationTypeAction[] | undefined) {\n if (!actions || actions.length === 0) return undefined\n return actions.map((action) => ({\n id: action.id,\n label: action.labelKey,\n labelKey: action.labelKey,\n variant: action.variant,\n icon: action.icon,\n commandId: action.commandId,\n href: action.href,\n confirmRequired: action.confirmRequired,\n confirmMessage: action.confirmMessageKey,\n }))\n}\n\n/**\n * Common options for building notifications from type definitions\n */\ninterface CommonBuildOptions {\n titleVariables?: Record<string, string>\n bodyVariables?: Record<string, string>\n sourceEntityType?: string\n sourceEntityId?: string\n linkHref?: string\n groupKey?: string\n expiresAt?: string\n}\n\n/**\n * Build base notification fields from a type definition.\n * Shared logic used by all notification builder functions.\n */\nfunction buildBaseNotificationFields(\n typeDef: NotificationTypeDefinition,\n options: CommonBuildOptions\n) {\n return {\n type: typeDef.type,\n titleKey: typeDef.titleKey,\n bodyKey: typeDef.bodyKey,\n titleVariables: options.titleVariables,\n bodyVariables: options.bodyVariables,\n title: typeDef.titleKey,\n body: typeDef.bodyKey,\n icon: typeDef.icon,\n severity: typeDef.severity,\n actions: mapActions(typeDef.actions),\n primaryActionId: typeDef.primaryActionId,\n sourceModule: typeDef.module,\n sourceEntityType: options.sourceEntityType,\n sourceEntityId: options.sourceEntityId,\n linkHref: options.linkHref ?? typeDef.linkHref,\n groupKey: options.groupKey,\n expiresAt: options.expiresAt ?? (\n typeDef.expiresAfterHours\n ? new Date(Date.now() + typeDef.expiresAfterHours * 60 * 60 * 1000).toISOString()\n : undefined\n ),\n }\n}\n\n/**\n * Build a notification input from a type definition with i18n support.\n * This is the recommended way to create notifications - use type definitions from notifications.ts\n * to ensure i18n-first approach.\n */\nexport function buildNotificationFromType(\n typeDef: NotificationTypeDefinition,\n options: CommonBuildOptions & { recipientUserId: string }\n): CreateNotificationInput {\n return {\n recipientUserId: options.recipientUserId,\n ...buildBaseNotificationFields(typeDef, options),\n }\n}\n\n/**\n * Build a batch notification input from a type definition\n */\nexport function buildBatchNotificationFromType(\n typeDef: NotificationTypeDefinition,\n options: CommonBuildOptions & { recipientUserIds: string[] }\n): CreateBatchNotificationInput {\n return {\n recipientUserIds: options.recipientUserIds,\n ...buildBaseNotificationFields(typeDef, options),\n }\n}\n\n/**\n * Build a role notification input from a type definition\n */\nexport function buildRoleNotificationFromType(\n typeDef: NotificationTypeDefinition,\n options: CommonBuildOptions & { roleId: string }\n): CreateRoleNotificationInput {\n return {\n roleId: options.roleId,\n ...buildBaseNotificationFields(typeDef, options),\n }\n}\n\n/**\n * Build a feature-based notification input from a type definition\n */\nexport function buildFeatureNotificationFromType(\n typeDef: NotificationTypeDefinition,\n options: CommonBuildOptions & { requiredFeature: string }\n): CreateFeatureNotificationInput {\n return {\n requiredFeature: options.requiredFeature,\n ...buildBaseNotificationFields(typeDef, options),\n }\n}\n"],
5
- "mappings": "AAOA,SAAS,WAAW,SAA+C;AACjE,MAAI,CAAC,WAAW,QAAQ,WAAW,EAAG,QAAO;AAC7C,SAAO,QAAQ,IAAI,CAAC,YAAY;AAAA,IAC9B,IAAI,OAAO;AAAA,IACX,OAAO,OAAO;AAAA,IACd,UAAU,OAAO;AAAA,IACjB,SAAS,OAAO;AAAA,IAChB,MAAM,OAAO;AAAA,IACb,WAAW,OAAO;AAAA,IAClB,MAAM,OAAO;AAAA,IACb,iBAAiB,OAAO;AAAA,IACxB,gBAAgB,OAAO;AAAA,EACzB,EAAE;AACJ;AAmBA,SAAS,4BACP,SACA,SACA;AACA,SAAO;AAAA,IACL,MAAM,QAAQ;AAAA,IACd,UAAU,QAAQ;AAAA,IAClB,SAAS,QAAQ;AAAA,IACjB,gBAAgB,QAAQ;AAAA,IACxB,eAAe,QAAQ;AAAA,IACvB,OAAO,QAAQ;AAAA,IACf,MAAM,QAAQ;AAAA,IACd,MAAM,QAAQ;AAAA,IACd,UAAU,QAAQ;AAAA,IAClB,SAAS,WAAW,QAAQ,OAAO;AAAA,IACnC,iBAAiB,QAAQ;AAAA,IACzB,cAAc,QAAQ;AAAA,IACtB,kBAAkB,QAAQ;AAAA,IAC1B,gBAAgB,QAAQ;AAAA,IACxB,UAAU,QAAQ,YAAY,QAAQ;AAAA,IACtC,UAAU,QAAQ;AAAA,IAClB,WAAW,QAAQ,cACjB,QAAQ,oBACJ,IAAI,KAAK,KAAK,IAAI,IAAI,QAAQ,oBAAoB,KAAK,KAAK,GAAI,EAAE,YAAY,IAC9E;AAAA,EAER;AACF;AAOO,SAAS,0BACd,SACA,SACyB;AACzB,SAAO;AAAA,IACL,iBAAiB,QAAQ;AAAA,IACzB,GAAG,4BAA4B,SAAS,OAAO;AAAA,EACjD;AACF;AAKO,SAAS,+BACd,SACA,SAC8B;AAC9B,SAAO;AAAA,IACL,kBAAkB,QAAQ;AAAA,IAC1B,GAAG,4BAA4B,SAAS,OAAO;AAAA,EACjD;AACF;AAKO,SAAS,8BACd,SACA,SAC6B;AAC7B,SAAO;AAAA,IACL,QAAQ,QAAQ;AAAA,IAChB,GAAG,4BAA4B,SAAS,OAAO;AAAA,EACjD;AACF;AAKO,SAAS,iCACd,SACA,SACgC;AAChC,SAAO;AAAA,IACL,iBAAiB,QAAQ;AAAA,IACzB,GAAG,4BAA4B,SAAS,OAAO;AAAA,EACjD;AACF;",
6
- "names": []
7
- }
@@ -1,54 +0,0 @@
1
- import { Notification } from "../data/entities.js";
2
- import { NOTIFICATION_EVENTS } from "./events.js";
3
- import { assertSafeNotificationHref, sanitizeNotificationActions } from "./safeHref.js";
4
- function buildNotificationEntity(em, input, recipientUserId, ctx) {
5
- const actions = sanitizeNotificationActions(input.actions);
6
- const linkHref = assertSafeNotificationHref(input.linkHref);
7
- return em.create(Notification, {
8
- recipientUserId,
9
- type: input.type,
10
- // i18n-first: store keys and variables for translation at display time
11
- titleKey: input.titleKey,
12
- bodyKey: input.bodyKey,
13
- titleVariables: input.titleVariables,
14
- bodyVariables: input.bodyVariables,
15
- // Fallback text (required for backward compatibility)
16
- title: input.title || input.titleKey || "",
17
- body: input.body,
18
- icon: input.icon,
19
- severity: input.severity ?? "info",
20
- actionData: actions ? {
21
- actions,
22
- primaryActionId: input.primaryActionId
23
- } : null,
24
- sourceModule: input.sourceModule,
25
- sourceEntityType: input.sourceEntityType,
26
- sourceEntityId: input.sourceEntityId,
27
- linkHref,
28
- groupKey: input.groupKey,
29
- expiresAt: input.expiresAt ? new Date(input.expiresAt) : null,
30
- tenantId: ctx.tenantId,
31
- organizationId: ctx.organizationId
32
- });
33
- }
34
- async function emitNotificationCreated(eventBus, notification, ctx) {
35
- await eventBus.emit(NOTIFICATION_EVENTS.CREATED, {
36
- notificationId: notification.id,
37
- recipientUserId: notification.recipientUserId,
38
- type: notification.type,
39
- title: notification.title,
40
- tenantId: ctx.tenantId,
41
- organizationId: ctx.organizationId
42
- });
43
- }
44
- async function emitNotificationCreatedBatch(eventBus, notifications, ctx) {
45
- for (const notification of notifications) {
46
- await emitNotificationCreated(eventBus, notification, ctx);
47
- }
48
- }
49
- export {
50
- buildNotificationEntity,
51
- emitNotificationCreated,
52
- emitNotificationCreatedBatch
53
- };
54
- //# sourceMappingURL=notificationFactory.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/modules/notifications/lib/notificationFactory.ts"],
4
- "sourcesContent": ["import type { EntityManager } from '@mikro-orm/core'\nimport { Notification } from '../data/entities'\nimport type { CreateNotificationInput } from '../data/validators'\nimport { NOTIFICATION_EVENTS } from './events'\nimport { assertSafeNotificationHref, sanitizeNotificationActions } from './safeHref'\n\nexport type NotificationContentInput = Omit<CreateNotificationInput, 'recipientUserId'>\n\nexport type NotificationTenantContext = {\n tenantId: string\n organizationId?: string | null\n}\n\nexport function buildNotificationEntity(\n em: EntityManager,\n input: NotificationContentInput,\n recipientUserId: string,\n ctx: NotificationTenantContext\n): Notification {\n const actions = sanitizeNotificationActions(input.actions)\n const linkHref = assertSafeNotificationHref(input.linkHref)\n\n return em.create(Notification, {\n recipientUserId,\n type: input.type,\n // i18n-first: store keys and variables for translation at display time\n titleKey: input.titleKey,\n bodyKey: input.bodyKey,\n titleVariables: input.titleVariables,\n bodyVariables: input.bodyVariables,\n // Fallback text (required for backward compatibility)\n title: input.title || input.titleKey || '',\n body: input.body,\n icon: input.icon,\n severity: input.severity ?? 'info',\n actionData: actions\n ? {\n actions,\n primaryActionId: input.primaryActionId,\n }\n : null,\n sourceModule: input.sourceModule,\n sourceEntityType: input.sourceEntityType,\n sourceEntityId: input.sourceEntityId,\n linkHref,\n groupKey: input.groupKey,\n expiresAt: input.expiresAt ? new Date(input.expiresAt) : null,\n tenantId: ctx.tenantId,\n organizationId: ctx.organizationId,\n })\n}\n\nexport async function emitNotificationCreated(\n eventBus: { emit: (event: string, payload: unknown) => Promise<void> },\n notification: Notification,\n ctx: NotificationTenantContext\n): Promise<void> {\n await eventBus.emit(NOTIFICATION_EVENTS.CREATED, {\n notificationId: notification.id,\n recipientUserId: notification.recipientUserId,\n type: notification.type,\n title: notification.title,\n tenantId: ctx.tenantId,\n organizationId: ctx.organizationId,\n })\n}\n\nexport async function emitNotificationCreatedBatch(\n eventBus: { emit: (event: string, payload: unknown) => Promise<void> },\n notifications: Notification[],\n ctx: NotificationTenantContext\n): Promise<void> {\n for (const notification of notifications) {\n await emitNotificationCreated(eventBus, notification, ctx)\n }\n}\n"],
5
- "mappings": "AACA,SAAS,oBAAoB;AAE7B,SAAS,2BAA2B;AACpC,SAAS,4BAA4B,mCAAmC;AASjE,SAAS,wBACd,IACA,OACA,iBACA,KACc;AACd,QAAM,UAAU,4BAA4B,MAAM,OAAO;AACzD,QAAM,WAAW,2BAA2B,MAAM,QAAQ;AAE1D,SAAO,GAAG,OAAO,cAAc;AAAA,IAC7B;AAAA,IACA,MAAM,MAAM;AAAA;AAAA,IAEZ,UAAU,MAAM;AAAA,IAChB,SAAS,MAAM;AAAA,IACf,gBAAgB,MAAM;AAAA,IACtB,eAAe,MAAM;AAAA;AAAA,IAErB,OAAO,MAAM,SAAS,MAAM,YAAY;AAAA,IACxC,MAAM,MAAM;AAAA,IACZ,MAAM,MAAM;AAAA,IACZ,UAAU,MAAM,YAAY;AAAA,IAC5B,YAAY,UACR;AAAA,MACE;AAAA,MACA,iBAAiB,MAAM;AAAA,IACzB,IACA;AAAA,IACJ,cAAc,MAAM;AAAA,IACpB,kBAAkB,MAAM;AAAA,IACxB,gBAAgB,MAAM;AAAA,IACtB;AAAA,IACA,UAAU,MAAM;AAAA,IAChB,WAAW,MAAM,YAAY,IAAI,KAAK,MAAM,SAAS,IAAI;AAAA,IACzD,UAAU,IAAI;AAAA,IACd,gBAAgB,IAAI;AAAA,EACtB,CAAC;AACH;AAEA,eAAsB,wBACpB,UACA,cACA,KACe;AACf,QAAM,SAAS,KAAK,oBAAoB,SAAS;AAAA,IAC/C,gBAAgB,aAAa;AAAA,IAC7B,iBAAiB,aAAa;AAAA,IAC9B,MAAM,aAAa;AAAA,IACnB,OAAO,aAAa;AAAA,IACpB,UAAU,IAAI;AAAA,IACd,gBAAgB,IAAI;AAAA,EACtB,CAAC;AACH;AAEA,eAAsB,6BACpB,UACA,eACA,KACe;AACf,aAAW,gBAAgB,eAAe;AACxC,UAAM,wBAAwB,UAAU,cAAc,GAAG;AAAA,EAC3D;AACF;",
6
- "names": []
7
- }
@@ -1,34 +0,0 @@
1
- function toNotificationDto(notification) {
2
- return {
3
- id: notification.id,
4
- type: notification.type,
5
- title: notification.title,
6
- body: notification.body,
7
- titleKey: notification.titleKey,
8
- bodyKey: notification.bodyKey,
9
- titleVariables: notification.titleVariables,
10
- bodyVariables: notification.bodyVariables,
11
- icon: notification.icon,
12
- severity: notification.severity,
13
- status: notification.status,
14
- actions: notification.actionData?.actions?.map((action) => ({
15
- id: action.id,
16
- label: action.label,
17
- labelKey: action.labelKey,
18
- variant: action.variant,
19
- icon: action.icon
20
- })) ?? [],
21
- primaryActionId: notification.actionData?.primaryActionId,
22
- sourceModule: notification.sourceModule,
23
- sourceEntityType: notification.sourceEntityType,
24
- sourceEntityId: notification.sourceEntityId,
25
- linkHref: notification.linkHref,
26
- createdAt: notification.createdAt.toISOString(),
27
- readAt: notification.readAt?.toISOString() ?? null,
28
- actionTaken: notification.actionTaken
29
- };
30
- }
31
- export {
32
- toNotificationDto
33
- };
34
- //# sourceMappingURL=notificationMapper.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/modules/notifications/lib/notificationMapper.ts"],
4
- "sourcesContent": ["import type { NotificationDto } from '@open-mercato/shared/modules/notifications/types'\nimport { Notification } from '../data/entities'\n\nexport function toNotificationDto(notification: Notification): NotificationDto {\n return {\n id: notification.id,\n type: notification.type,\n title: notification.title,\n body: notification.body,\n titleKey: notification.titleKey,\n bodyKey: notification.bodyKey,\n titleVariables: notification.titleVariables,\n bodyVariables: notification.bodyVariables,\n icon: notification.icon,\n severity: notification.severity,\n status: notification.status,\n actions: notification.actionData?.actions?.map((action) => ({\n id: action.id,\n label: action.label,\n labelKey: action.labelKey,\n variant: action.variant,\n icon: action.icon,\n })) ?? [],\n primaryActionId: notification.actionData?.primaryActionId,\n sourceModule: notification.sourceModule,\n sourceEntityType: notification.sourceEntityType,\n sourceEntityId: notification.sourceEntityId,\n linkHref: notification.linkHref,\n createdAt: notification.createdAt.toISOString(),\n readAt: notification.readAt?.toISOString() ?? null,\n actionTaken: notification.actionTaken,\n }\n}\n"],
5
- "mappings": "AAGO,SAAS,kBAAkB,cAA6C;AAC7E,SAAO;AAAA,IACL,IAAI,aAAa;AAAA,IACjB,MAAM,aAAa;AAAA,IACnB,OAAO,aAAa;AAAA,IACpB,MAAM,aAAa;AAAA,IACnB,UAAU,aAAa;AAAA,IACvB,SAAS,aAAa;AAAA,IACtB,gBAAgB,aAAa;AAAA,IAC7B,eAAe,aAAa;AAAA,IAC5B,MAAM,aAAa;AAAA,IACnB,UAAU,aAAa;AAAA,IACvB,QAAQ,aAAa;AAAA,IACrB,SAAS,aAAa,YAAY,SAAS,IAAI,CAAC,YAAY;AAAA,MAC1D,IAAI,OAAO;AAAA,MACX,OAAO,OAAO;AAAA,MACd,UAAU,OAAO;AAAA,MACjB,SAAS,OAAO;AAAA,MAChB,MAAM,OAAO;AAAA,IACf,EAAE,KAAK,CAAC;AAAA,IACR,iBAAiB,aAAa,YAAY;AAAA,IAC1C,cAAc,aAAa;AAAA,IAC3B,kBAAkB,aAAa;AAAA,IAC/B,gBAAgB,aAAa;AAAA,IAC7B,UAAU,aAAa;AAAA,IACvB,WAAW,aAAa,UAAU,YAAY;AAAA,IAC9C,QAAQ,aAAa,QAAQ,YAAY,KAAK;AAAA,IAC9C,aAAa,aAAa;AAAA,EAC5B;AACF;",
6
- "names": []
7
- }
@@ -1,35 +0,0 @@
1
- import { hasFeature } from "@open-mercato/shared/security/features";
2
- function normalizeFeatures(features) {
3
- if (!Array.isArray(features)) return void 0;
4
- const normalized = features.filter((feature) => typeof feature === "string");
5
- return normalized.length ? normalized : void 0;
6
- }
7
- function collectUsersWithFeature(userIdsSet, rows, requiredFeature) {
8
- for (const row of rows) {
9
- if (row.is_super_admin) {
10
- userIdsSet.add(row.user_id);
11
- continue;
12
- }
13
- const features = normalizeFeatures(row.features_json);
14
- if (features && hasFeature(features, requiredFeature)) {
15
- userIdsSet.add(row.user_id);
16
- }
17
- }
18
- }
19
- async function getRecipientUserIdsForRole(knex, tenantId, roleId) {
20
- const userRoles = await knex("user_roles").join("users", "user_roles.user_id", "users.id").where("user_roles.role_id", roleId).whereNull("user_roles.deleted_at").whereNull("users.deleted_at").where("users.tenant_id", tenantId).select("users.id as user_id");
21
- return userRoles.map((row) => row.user_id);
22
- }
23
- async function getRecipientUserIdsForFeature(knex, tenantId, requiredFeature) {
24
- const userIdsSet = /* @__PURE__ */ new Set();
25
- const userAcls = await knex("user_acls").join("users", "user_acls.user_id", "users.id").where("user_acls.tenant_id", tenantId).whereNull("user_acls.deleted_at").whereNull("users.deleted_at").where("users.tenant_id", tenantId).select("users.id as user_id", "user_acls.features_json", "user_acls.is_super_admin");
26
- collectUsersWithFeature(userIdsSet, userAcls, requiredFeature);
27
- const roleAcls = await knex("role_acls").join("user_roles", "role_acls.role_id", "user_roles.role_id").join("users", "user_roles.user_id", "users.id").where("role_acls.tenant_id", tenantId).whereNull("role_acls.deleted_at").whereNull("user_roles.deleted_at").whereNull("users.deleted_at").where("users.tenant_id", tenantId).select("users.id as user_id", "role_acls.features_json", "role_acls.is_super_admin");
28
- collectUsersWithFeature(userIdsSet, roleAcls, requiredFeature);
29
- return Array.from(userIdsSet);
30
- }
31
- export {
32
- getRecipientUserIdsForFeature,
33
- getRecipientUserIdsForRole
34
- };
35
- //# sourceMappingURL=notificationRecipients.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/modules/notifications/lib/notificationRecipients.ts"],
4
- "sourcesContent": ["import type { Knex } from 'knex'\nimport { hasFeature } from '@open-mercato/shared/security/features'\n\ninterface AclRow {\n user_id: string\n features_json: unknown\n is_super_admin: boolean\n}\n\nfunction normalizeFeatures(features: unknown): string[] | undefined {\n if (!Array.isArray(features)) return undefined\n const normalized = features.filter((feature): feature is string => typeof feature === 'string')\n return normalized.length ? normalized : undefined\n}\n\n/**\n * Extract user IDs from ACL rows that have the required feature or are super admins.\n */\nfunction collectUsersWithFeature(\n userIdsSet: Set<string>,\n rows: AclRow[],\n requiredFeature: string\n): void {\n for (const row of rows) {\n if (row.is_super_admin) {\n userIdsSet.add(row.user_id)\n continue\n }\n\n const features = normalizeFeatures(row.features_json)\n if (features && hasFeature(features, requiredFeature)) {\n userIdsSet.add(row.user_id)\n }\n }\n}\n\nexport async function getRecipientUserIdsForRole(\n knex: Knex,\n tenantId: string,\n roleId: string\n): Promise<string[]> {\n const userRoles = await knex('user_roles')\n .join('users', 'user_roles.user_id', 'users.id')\n .where('user_roles.role_id', roleId)\n .whereNull('user_roles.deleted_at')\n .whereNull('users.deleted_at')\n .where('users.tenant_id', tenantId)\n .select('users.id as user_id')\n\n return userRoles.map((row: { user_id: string }) => row.user_id)\n}\n\nexport async function getRecipientUserIdsForFeature(\n knex: Knex,\n tenantId: string,\n requiredFeature: string\n): Promise<string[]> {\n const userIdsSet = new Set<string>()\n\n const userAcls = await knex('user_acls')\n .join('users', 'user_acls.user_id', 'users.id')\n .where('user_acls.tenant_id', tenantId)\n .whereNull('user_acls.deleted_at')\n .whereNull('users.deleted_at')\n .where('users.tenant_id', tenantId)\n .select('users.id as user_id', 'user_acls.features_json', 'user_acls.is_super_admin')\n\n collectUsersWithFeature(userIdsSet, userAcls, requiredFeature)\n\n const roleAcls = await knex('role_acls')\n .join('user_roles', 'role_acls.role_id', 'user_roles.role_id')\n .join('users', 'user_roles.user_id', 'users.id')\n .where('role_acls.tenant_id', tenantId)\n .whereNull('role_acls.deleted_at')\n .whereNull('user_roles.deleted_at')\n .whereNull('users.deleted_at')\n .where('users.tenant_id', tenantId)\n .select('users.id as user_id', 'role_acls.features_json', 'role_acls.is_super_admin')\n\n collectUsersWithFeature(userIdsSet, roleAcls, requiredFeature)\n\n return Array.from(userIdsSet)\n}\n"],
5
- "mappings": "AACA,SAAS,kBAAkB;AAQ3B,SAAS,kBAAkB,UAAyC;AAClE,MAAI,CAAC,MAAM,QAAQ,QAAQ,EAAG,QAAO;AACrC,QAAM,aAAa,SAAS,OAAO,CAAC,YAA+B,OAAO,YAAY,QAAQ;AAC9F,SAAO,WAAW,SAAS,aAAa;AAC1C;AAKA,SAAS,wBACP,YACA,MACA,iBACM;AACN,aAAW,OAAO,MAAM;AACtB,QAAI,IAAI,gBAAgB;AACtB,iBAAW,IAAI,IAAI,OAAO;AAC1B;AAAA,IACF;AAEA,UAAM,WAAW,kBAAkB,IAAI,aAAa;AACpD,QAAI,YAAY,WAAW,UAAU,eAAe,GAAG;AACrD,iBAAW,IAAI,IAAI,OAAO;AAAA,IAC5B;AAAA,EACF;AACF;AAEA,eAAsB,2BACpB,MACA,UACA,QACmB;AACnB,QAAM,YAAY,MAAM,KAAK,YAAY,EACtC,KAAK,SAAS,sBAAsB,UAAU,EAC9C,MAAM,sBAAsB,MAAM,EAClC,UAAU,uBAAuB,EACjC,UAAU,kBAAkB,EAC5B,MAAM,mBAAmB,QAAQ,EACjC,OAAO,qBAAqB;AAE/B,SAAO,UAAU,IAAI,CAAC,QAA6B,IAAI,OAAO;AAChE;AAEA,eAAsB,8BACpB,MACA,UACA,iBACmB;AACnB,QAAM,aAAa,oBAAI,IAAY;AAEnC,QAAM,WAAW,MAAM,KAAK,WAAW,EACpC,KAAK,SAAS,qBAAqB,UAAU,EAC7C,MAAM,uBAAuB,QAAQ,EACrC,UAAU,sBAAsB,EAChC,UAAU,kBAAkB,EAC5B,MAAM,mBAAmB,QAAQ,EACjC,OAAO,uBAAuB,2BAA2B,0BAA0B;AAEtF,0BAAwB,YAAY,UAAU,eAAe;AAE7D,QAAM,WAAW,MAAM,KAAK,WAAW,EACpC,KAAK,cAAc,qBAAqB,oBAAoB,EAC5D,KAAK,SAAS,sBAAsB,UAAU,EAC9C,MAAM,uBAAuB,QAAQ,EACrC,UAAU,sBAAsB,EAChC,UAAU,uBAAuB,EACjC,UAAU,kBAAkB,EAC5B,MAAM,mBAAmB,QAAQ,EACjC,OAAO,uBAAuB,2BAA2B,0BAA0B;AAEtF,0BAAwB,YAAY,UAAU,eAAe;AAE7D,SAAO,MAAM,KAAK,UAAU;AAC9B;",
6
- "names": []
7
- }
@@ -1,279 +0,0 @@
1
- import { Notification } from "../data/entities.js";
2
- import { NOTIFICATION_EVENTS } from "./events.js";
3
- import { buildNotificationEntity, emitNotificationCreated, emitNotificationCreatedBatch } from "./notificationFactory.js";
4
- import { toNotificationDto } from "./notificationMapper.js";
5
- import { getRecipientUserIdsForFeature, getRecipientUserIdsForRole } from "./notificationRecipients.js";
6
- const DEBUG = process.env.NOTIFICATIONS_DEBUG === "true";
7
- function debug(...args) {
8
- if (DEBUG) {
9
- console.log("[notifications]", ...args);
10
- }
11
- }
12
- function getKnex(em) {
13
- return em.getConnection().getKnex();
14
- }
15
- function createNotificationService(deps) {
16
- const { em: rootEm, eventBus, commandBus, container } = deps;
17
- return {
18
- async create(input, ctx) {
19
- const em = rootEm.fork();
20
- const { recipientUserId, ...content } = input;
21
- const notification = buildNotificationEntity(em, content, recipientUserId, ctx);
22
- await em.persistAndFlush(notification);
23
- await emitNotificationCreated(eventBus, notification, ctx);
24
- return notification;
25
- },
26
- async createBatch(input, ctx) {
27
- const em = rootEm.fork();
28
- const { recipientUserIds, ...content } = input;
29
- const notifications = [];
30
- for (const recipientUserId of recipientUserIds) {
31
- const notification = buildNotificationEntity(em, content, recipientUserId, ctx);
32
- notifications.push(notification);
33
- }
34
- await em.persistAndFlush(notifications);
35
- await emitNotificationCreatedBatch(eventBus, notifications, ctx);
36
- return notifications;
37
- },
38
- async createForRole(input, ctx) {
39
- const em = rootEm.fork();
40
- const knex = getKnex(em);
41
- const recipientUserIds = await getRecipientUserIdsForRole(knex, ctx.tenantId, input.roleId);
42
- if (recipientUserIds.length === 0) {
43
- return [];
44
- }
45
- const { roleId: _roleId, ...content } = input;
46
- const notifications = [];
47
- for (const recipientUserId of recipientUserIds) {
48
- const notification = buildNotificationEntity(em, content, recipientUserId, ctx);
49
- notifications.push(notification);
50
- }
51
- await em.persistAndFlush(notifications);
52
- await emitNotificationCreatedBatch(eventBus, notifications, ctx);
53
- return notifications;
54
- },
55
- async createForFeature(input, ctx) {
56
- const em = rootEm.fork();
57
- const knex = getKnex(em);
58
- const recipientUserIds = await getRecipientUserIdsForFeature(knex, ctx.tenantId, input.requiredFeature);
59
- if (recipientUserIds.length === 0) {
60
- debug("No users found with feature:", input.requiredFeature, "in tenant:", ctx.tenantId);
61
- return [];
62
- }
63
- debug("Creating notifications for", recipientUserIds.length, "user(s) with feature:", input.requiredFeature);
64
- const { requiredFeature: _requiredFeature, ...content } = input;
65
- const notifications = [];
66
- for (const recipientUserId of recipientUserIds) {
67
- const notification = buildNotificationEntity(em, content, recipientUserId, ctx);
68
- notifications.push(notification);
69
- }
70
- await em.persistAndFlush(notifications);
71
- await emitNotificationCreatedBatch(eventBus, notifications, ctx);
72
- return notifications;
73
- },
74
- async markAsRead(notificationId, ctx) {
75
- const em = rootEm.fork();
76
- const notification = await em.findOneOrFail(Notification, {
77
- id: notificationId,
78
- recipientUserId: ctx.userId,
79
- tenantId: ctx.tenantId
80
- });
81
- if (notification.status === "unread") {
82
- notification.status = "read";
83
- notification.readAt = /* @__PURE__ */ new Date();
84
- await em.flush();
85
- await eventBus.emit(NOTIFICATION_EVENTS.READ, {
86
- notificationId: notification.id,
87
- userId: ctx.userId,
88
- tenantId: ctx.tenantId
89
- });
90
- }
91
- return notification;
92
- },
93
- async markAllAsRead(ctx) {
94
- const em = rootEm.fork();
95
- const knex = getKnex(em);
96
- const result = await knex("notifications").where({
97
- recipient_user_id: ctx.userId,
98
- tenant_id: ctx.tenantId,
99
- status: "unread"
100
- }).update({
101
- status: "read",
102
- read_at: knex.fn.now()
103
- });
104
- return result;
105
- },
106
- async dismiss(notificationId, ctx) {
107
- const em = rootEm.fork();
108
- const notification = await em.findOneOrFail(Notification, {
109
- id: notificationId,
110
- recipientUserId: ctx.userId,
111
- tenantId: ctx.tenantId
112
- });
113
- notification.status = "dismissed";
114
- notification.dismissedAt = /* @__PURE__ */ new Date();
115
- await em.flush();
116
- await eventBus.emit(NOTIFICATION_EVENTS.DISMISSED, {
117
- notificationId: notification.id,
118
- userId: ctx.userId,
119
- tenantId: ctx.tenantId
120
- });
121
- return notification;
122
- },
123
- async restoreDismissed(notificationId, status, ctx) {
124
- const em = rootEm.fork();
125
- const notification = await em.findOneOrFail(Notification, {
126
- id: notificationId,
127
- recipientUserId: ctx.userId,
128
- tenantId: ctx.tenantId
129
- });
130
- if (notification.status !== "dismissed") {
131
- return notification;
132
- }
133
- const targetStatus = status ?? "read";
134
- notification.status = targetStatus;
135
- notification.dismissedAt = null;
136
- if (targetStatus === "unread") {
137
- notification.readAt = null;
138
- } else if (!notification.readAt) {
139
- notification.readAt = /* @__PURE__ */ new Date();
140
- }
141
- await em.flush();
142
- await eventBus.emit(NOTIFICATION_EVENTS.RESTORED, {
143
- notificationId: notification.id,
144
- userId: ctx.userId,
145
- tenantId: ctx.tenantId,
146
- status: targetStatus
147
- });
148
- return notification;
149
- },
150
- async executeAction(notificationId, input, ctx) {
151
- const em = rootEm.fork();
152
- const notification = await em.findOneOrFail(Notification, {
153
- id: notificationId,
154
- recipientUserId: ctx.userId,
155
- tenantId: ctx.tenantId
156
- });
157
- const actionData = notification.actionData;
158
- const action = actionData?.actions?.find((a) => a.id === input.actionId);
159
- if (!action) {
160
- throw new Error("Action not found");
161
- }
162
- let result = null;
163
- if (action.commandId && commandBus && container) {
164
- const commandInput = {
165
- id: notification.sourceEntityId,
166
- ...input.payload
167
- };
168
- const commandCtx = {
169
- container,
170
- auth: {
171
- sub: ctx.userId,
172
- tenantId: ctx.tenantId,
173
- orgId: ctx.organizationId
174
- },
175
- organizationScope: null,
176
- selectedOrganizationId: ctx.organizationId ?? null,
177
- organizationIds: ctx.organizationId ? [ctx.organizationId] : null
178
- };
179
- const commandResult = await commandBus.execute(action.commandId, {
180
- input: commandInput,
181
- ctx: commandCtx,
182
- metadata: {
183
- tenantId: ctx.tenantId,
184
- organizationId: ctx.organizationId,
185
- resourceKind: "notifications"
186
- }
187
- });
188
- result = commandResult.result;
189
- }
190
- notification.status = "actioned";
191
- notification.actionedAt = /* @__PURE__ */ new Date();
192
- notification.actionTaken = input.actionId;
193
- notification.actionResult = result;
194
- if (!notification.readAt) {
195
- notification.readAt = /* @__PURE__ */ new Date();
196
- }
197
- await em.flush();
198
- await eventBus.emit(NOTIFICATION_EVENTS.ACTIONED, {
199
- notificationId: notification.id,
200
- actionId: input.actionId,
201
- userId: ctx.userId,
202
- tenantId: ctx.tenantId
203
- });
204
- return { notification, result };
205
- },
206
- async getUnreadCount(ctx) {
207
- const em = rootEm.fork();
208
- return em.count(Notification, {
209
- recipientUserId: ctx.userId,
210
- tenantId: ctx.tenantId,
211
- status: "unread"
212
- });
213
- },
214
- async getPollData(ctx, since) {
215
- const em = rootEm.fork();
216
- const filters = {
217
- recipientUserId: ctx.userId,
218
- tenantId: ctx.tenantId
219
- };
220
- if (since) {
221
- filters.createdAt = { $gt: new Date(since) };
222
- }
223
- const [notifications, unreadCount] = await Promise.all([
224
- em.find(Notification, filters, {
225
- orderBy: { createdAt: "desc" },
226
- limit: 50
227
- }),
228
- em.count(Notification, {
229
- recipientUserId: ctx.userId,
230
- tenantId: ctx.tenantId,
231
- status: "unread"
232
- })
233
- ]);
234
- const recent = notifications.map(toNotificationDto);
235
- const hasNew = since ? recent.length > 0 : false;
236
- return {
237
- unreadCount,
238
- recent,
239
- hasNew,
240
- lastId: recent[0]?.id
241
- };
242
- },
243
- async cleanupExpired() {
244
- const em = rootEm.fork();
245
- const knex = getKnex(em);
246
- const result = await knex("notifications").where("expires_at", "<", knex.fn.now()).whereNotIn("status", ["actioned", "dismissed"]).update({
247
- status: "dismissed",
248
- dismissed_at: knex.fn.now()
249
- });
250
- return result;
251
- },
252
- async deleteBySource(sourceEntityType, sourceEntityId, ctx) {
253
- const em = rootEm.fork();
254
- const knex = getKnex(em);
255
- const result = await knex("notifications").where({
256
- source_entity_type: sourceEntityType,
257
- source_entity_id: sourceEntityId,
258
- tenant_id: ctx.tenantId
259
- }).delete();
260
- return result;
261
- }
262
- };
263
- }
264
- function resolveNotificationService(container) {
265
- const em = container.resolve("em");
266
- const eventBus = container.resolve("eventBus");
267
- let commandBus;
268
- try {
269
- commandBus = container.resolve("commandBus");
270
- } catch {
271
- commandBus = void 0;
272
- }
273
- return createNotificationService({ em, eventBus, commandBus, container });
274
- }
275
- export {
276
- createNotificationService,
277
- resolveNotificationService
278
- };
279
- //# sourceMappingURL=notificationService.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/modules/notifications/lib/notificationService.ts"],
4
- "sourcesContent": ["import type { EntityManager } from '@mikro-orm/core'\nimport type { Knex } from 'knex'\nimport { Notification } from '../data/entities'\nimport type { CreateNotificationInput, CreateBatchNotificationInput, CreateRoleNotificationInput, CreateFeatureNotificationInput, ExecuteActionInput } from '../data/validators'\nimport type { NotificationPollData } from '@open-mercato/shared/modules/notifications/types'\nimport { NOTIFICATION_EVENTS } from './events'\nimport { buildNotificationEntity, emitNotificationCreated, emitNotificationCreatedBatch } from './notificationFactory'\nimport { toNotificationDto } from './notificationMapper'\nimport { getRecipientUserIdsForFeature, getRecipientUserIdsForRole } from './notificationRecipients'\n\nconst DEBUG = process.env.NOTIFICATIONS_DEBUG === 'true'\n\nfunction debug(...args: unknown[]): void {\n if (DEBUG) {\n console.log('[notifications]', ...args)\n }\n}\n\nfunction getKnex(em: EntityManager): Knex {\n return (em.getConnection() as unknown as { getKnex: () => Knex }).getKnex()\n}\n\nexport interface NotificationServiceContext {\n tenantId: string\n organizationId?: string | null\n userId?: string | null\n}\n\nexport interface NotificationService {\n create(input: CreateNotificationInput, ctx: NotificationServiceContext): Promise<Notification>\n createBatch(input: CreateBatchNotificationInput, ctx: NotificationServiceContext): Promise<Notification[]>\n createForRole(input: CreateRoleNotificationInput, ctx: NotificationServiceContext): Promise<Notification[]>\n createForFeature(input: CreateFeatureNotificationInput, ctx: NotificationServiceContext): Promise<Notification[]>\n markAsRead(notificationId: string, ctx: NotificationServiceContext): Promise<Notification>\n markAllAsRead(ctx: NotificationServiceContext): Promise<number>\n dismiss(notificationId: string, ctx: NotificationServiceContext): Promise<Notification>\n restoreDismissed(\n notificationId: string,\n status: 'read' | 'unread' | undefined,\n ctx: NotificationServiceContext\n ): Promise<Notification>\n executeAction(\n notificationId: string,\n input: ExecuteActionInput,\n ctx: NotificationServiceContext\n ): Promise<{ notification: Notification; result: unknown }>\n getUnreadCount(ctx: NotificationServiceContext): Promise<number>\n getPollData(ctx: NotificationServiceContext, since?: string): Promise<NotificationPollData>\n cleanupExpired(): Promise<number>\n deleteBySource(\n sourceEntityType: string,\n sourceEntityId: string,\n ctx: NotificationServiceContext\n ): Promise<number>\n}\n\nexport interface NotificationServiceDeps {\n em: EntityManager\n eventBus: { emit: (event: string, payload: unknown) => Promise<void> }\n commandBus?: {\n execute: (\n commandId: string,\n options: { input: unknown; ctx: unknown; metadata?: unknown }\n ) => Promise<{ result: unknown }>\n }\n container?: { resolve: (name: string) => unknown }\n}\n\nexport function createNotificationService(deps: NotificationServiceDeps): NotificationService {\n const { em: rootEm, eventBus, commandBus, container } = deps\n\n return {\n async create(input, ctx) {\n const em = rootEm.fork()\n const { recipientUserId, ...content } = input\n const notification = buildNotificationEntity(em, content, recipientUserId, ctx)\n\n await em.persistAndFlush(notification)\n\n await emitNotificationCreated(eventBus, notification, ctx)\n\n return notification\n },\n\n async createBatch(input, ctx) {\n const em = rootEm.fork()\n const { recipientUserIds, ...content } = input\n const notifications: Notification[] = []\n\n for (const recipientUserId of recipientUserIds) {\n const notification = buildNotificationEntity(em, content, recipientUserId, ctx)\n notifications.push(notification)\n }\n\n await em.persistAndFlush(notifications)\n\n await emitNotificationCreatedBatch(eventBus, notifications, ctx)\n\n return notifications\n },\n\n async createForRole(input, ctx) {\n const em = rootEm.fork()\n\n const knex = getKnex(em)\n const recipientUserIds = await getRecipientUserIdsForRole(knex, ctx.tenantId, input.roleId)\n if (recipientUserIds.length === 0) {\n return []\n }\n\n const { roleId: _roleId, ...content } = input\n const notifications: Notification[] = []\n\n for (const recipientUserId of recipientUserIds) {\n const notification = buildNotificationEntity(em, content, recipientUserId, ctx)\n notifications.push(notification)\n }\n\n await em.persistAndFlush(notifications)\n\n await emitNotificationCreatedBatch(eventBus, notifications, ctx)\n\n return notifications\n },\n\n async createForFeature(input, ctx) {\n const em = rootEm.fork()\n const knex = getKnex(em)\n const recipientUserIds = await getRecipientUserIdsForFeature(knex, ctx.tenantId, input.requiredFeature)\n\n if (recipientUserIds.length === 0) {\n debug('No users found with feature:', input.requiredFeature, 'in tenant:', ctx.tenantId)\n return []\n }\n\n debug('Creating notifications for', recipientUserIds.length, 'user(s) with feature:', input.requiredFeature)\n\n const { requiredFeature: _requiredFeature, ...content } = input\n const notifications: Notification[] = []\n\n for (const recipientUserId of recipientUserIds) {\n const notification = buildNotificationEntity(em, content, recipientUserId, ctx)\n notifications.push(notification)\n }\n\n await em.persistAndFlush(notifications)\n\n await emitNotificationCreatedBatch(eventBus, notifications, ctx)\n\n return notifications\n },\n\n async markAsRead(notificationId, ctx) {\n const em = rootEm.fork()\n const notification = await em.findOneOrFail(Notification, {\n id: notificationId,\n recipientUserId: ctx.userId,\n tenantId: ctx.tenantId,\n })\n\n if (notification.status === 'unread') {\n notification.status = 'read'\n notification.readAt = new Date()\n await em.flush()\n\n await eventBus.emit(NOTIFICATION_EVENTS.READ, {\n notificationId: notification.id,\n userId: ctx.userId,\n tenantId: ctx.tenantId,\n })\n }\n\n return notification\n },\n\n async markAllAsRead(ctx) {\n const em = rootEm.fork()\n const knex = getKnex(em)\n\n const result = await knex('notifications')\n .where({\n recipient_user_id: ctx.userId,\n tenant_id: ctx.tenantId,\n status: 'unread',\n })\n .update({\n status: 'read',\n read_at: knex.fn.now(),\n })\n\n return result\n },\n\n async dismiss(notificationId, ctx) {\n const em = rootEm.fork()\n const notification = await em.findOneOrFail(Notification, {\n id: notificationId,\n recipientUserId: ctx.userId,\n tenantId: ctx.tenantId,\n })\n\n notification.status = 'dismissed'\n notification.dismissedAt = new Date()\n await em.flush()\n\n await eventBus.emit(NOTIFICATION_EVENTS.DISMISSED, {\n notificationId: notification.id,\n userId: ctx.userId,\n tenantId: ctx.tenantId,\n })\n\n return notification\n },\n\n async restoreDismissed(notificationId, status, ctx) {\n const em = rootEm.fork()\n const notification = await em.findOneOrFail(Notification, {\n id: notificationId,\n recipientUserId: ctx.userId,\n tenantId: ctx.tenantId,\n })\n\n if (notification.status !== 'dismissed') {\n return notification\n }\n\n const targetStatus = status ?? 'read'\n notification.status = targetStatus\n notification.dismissedAt = null\n\n if (targetStatus === 'unread') {\n notification.readAt = null\n } else if (!notification.readAt) {\n notification.readAt = new Date()\n }\n\n await em.flush()\n\n await eventBus.emit(NOTIFICATION_EVENTS.RESTORED, {\n notificationId: notification.id,\n userId: ctx.userId,\n tenantId: ctx.tenantId,\n status: targetStatus,\n })\n\n return notification\n },\n\n async executeAction(notificationId, input, ctx) {\n const em = rootEm.fork()\n const notification = await em.findOneOrFail(Notification, {\n id: notificationId,\n recipientUserId: ctx.userId,\n tenantId: ctx.tenantId,\n })\n\n const actionData = notification.actionData\n const action = actionData?.actions?.find((a) => a.id === input.actionId)\n\n if (!action) {\n throw new Error('Action not found')\n }\n\n let result: unknown = null\n\n if (action.commandId && commandBus && container) {\n const commandInput = {\n id: notification.sourceEntityId,\n ...input.payload,\n }\n\n // Build a CommandRuntimeContext from the notification service context\n const commandCtx = {\n container,\n auth: {\n sub: ctx.userId,\n tenantId: ctx.tenantId,\n orgId: ctx.organizationId,\n },\n organizationScope: null,\n selectedOrganizationId: ctx.organizationId ?? null,\n organizationIds: ctx.organizationId ? [ctx.organizationId] : null,\n }\n\n const commandResult = await commandBus.execute(action.commandId, {\n input: commandInput,\n ctx: commandCtx,\n metadata: {\n tenantId: ctx.tenantId,\n organizationId: ctx.organizationId,\n resourceKind: 'notifications',\n },\n })\n\n result = commandResult.result\n }\n\n notification.status = 'actioned'\n notification.actionedAt = new Date()\n notification.actionTaken = input.actionId\n notification.actionResult = result as Record<string, unknown>\n\n if (!notification.readAt) {\n notification.readAt = new Date()\n }\n\n await em.flush()\n\n await eventBus.emit(NOTIFICATION_EVENTS.ACTIONED, {\n notificationId: notification.id,\n actionId: input.actionId,\n userId: ctx.userId,\n tenantId: ctx.tenantId,\n })\n\n return { notification, result }\n },\n\n async getUnreadCount(ctx) {\n const em = rootEm.fork()\n return em.count(Notification, {\n recipientUserId: ctx.userId,\n tenantId: ctx.tenantId,\n status: 'unread',\n })\n },\n\n async getPollData(ctx, since) {\n const em = rootEm.fork()\n const filters: Record<string, unknown> = {\n recipientUserId: ctx.userId,\n tenantId: ctx.tenantId,\n }\n\n if (since) {\n filters.createdAt = { $gt: new Date(since) }\n }\n\n const [notifications, unreadCount] = await Promise.all([\n em.find(Notification, filters, {\n orderBy: { createdAt: 'desc' },\n limit: 50,\n }),\n em.count(Notification, {\n recipientUserId: ctx.userId,\n tenantId: ctx.tenantId,\n status: 'unread',\n }),\n ])\n\n const recent = notifications.map(toNotificationDto)\n const hasNew = since ? recent.length > 0 : false\n\n return {\n unreadCount,\n recent,\n hasNew,\n lastId: recent[0]?.id,\n }\n },\n\n async cleanupExpired() {\n const em = rootEm.fork()\n const knex = getKnex(em)\n\n const result = await knex('notifications')\n .where('expires_at', '<', knex.fn.now())\n .whereNotIn('status', ['actioned', 'dismissed'])\n .update({\n status: 'dismissed',\n dismissed_at: knex.fn.now(),\n })\n\n return result\n },\n\n async deleteBySource(sourceEntityType, sourceEntityId, ctx) {\n const em = rootEm.fork()\n const knex = getKnex(em)\n\n const result = await knex('notifications')\n .where({\n source_entity_type: sourceEntityType,\n source_entity_id: sourceEntityId,\n tenant_id: ctx.tenantId,\n })\n .delete()\n\n return result\n },\n }\n}\n\n/**\n * Helper to create notification service from a DI container.\n * Use this in API routes and commands to avoid DI resolution issues.\n */\nexport function resolveNotificationService(container: {\n resolve: (name: string) => unknown\n}): NotificationService {\n const em = container.resolve('em') as EntityManager\n const eventBus = container.resolve('eventBus') as { emit: (event: string, payload: unknown) => Promise<void> }\n\n // commandBus may not be registered in all contexts, so resolve it safely\n let commandBus: NotificationServiceDeps['commandBus']\n try {\n commandBus = container.resolve('commandBus') as typeof commandBus\n } catch {\n // commandBus not available - actions with commandId won't work\n commandBus = undefined\n }\n\n return createNotificationService({ em, eventBus, commandBus, container })\n}\n"],
5
- "mappings": "AAEA,SAAS,oBAAoB;AAG7B,SAAS,2BAA2B;AACpC,SAAS,yBAAyB,yBAAyB,oCAAoC;AAC/F,SAAS,yBAAyB;AAClC,SAAS,+BAA+B,kCAAkC;AAE1E,MAAM,QAAQ,QAAQ,IAAI,wBAAwB;AAElD,SAAS,SAAS,MAAuB;AACvC,MAAI,OAAO;AACT,YAAQ,IAAI,mBAAmB,GAAG,IAAI;AAAA,EACxC;AACF;AAEA,SAAS,QAAQ,IAAyB;AACxC,SAAQ,GAAG,cAAc,EAAyC,QAAQ;AAC5E;AAgDO,SAAS,0BAA0B,MAAoD;AAC5F,QAAM,EAAE,IAAI,QAAQ,UAAU,YAAY,UAAU,IAAI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