adminizer 4.6.0 → 4.7.0-build.221

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 (335) hide show
  1. package/Readme.md +12 -0
  2. package/assets/RelationDialogStack-CnHFOYyR.css +1 -0
  3. package/assets/RelationDialogStack-DI2bZxQX.js +20 -0
  4. package/assets/add-4213XScp.js +1 -0
  5. package/assets/add-group--F1XxfJ1.js +1 -0
  6. package/assets/add-group-form-DKRXC2n-.js +1 -0
  7. package/assets/add-user-b9HfMq7z.js +1 -0
  8. package/assets/add-user-form-UXAToWQd.js +1 -0
  9. package/assets/app-Clx8f5hd.css +1 -0
  10. package/assets/app-layout-C02ja4OI.js +1 -0
  11. package/assets/app-shell-D8wtkECO.js +1 -0
  12. package/assets/app-sidebar-BR5_zwxj.js +1 -0
  13. package/assets/app-sidebar-header-BZbIBQjq.js +1 -0
  14. package/assets/app.js +59 -7990
  15. package/assets/breadcrumbs-CODaqVkB.js +1 -0
  16. package/assets/catalog-6ZZjWdFs.js +6 -0
  17. package/assets/dashboard-CftAdKiH.js +3 -0
  18. package/assets/date-picker-DSOkNiNo.js +1 -0
  19. package/assets/del-modal-Cd4M7af8.js +1 -0
  20. package/assets/dynamic-controls-BsrJhPDY.js +1 -0
  21. package/assets/geo-json-CzR5JBXL.js +1 -0
  22. package/assets/handsontable-BI98OF5R.js +336 -0
  23. package/assets/history-DLHSU7Ak.js +1 -0
  24. package/assets/home-NcQ7nnU0.js +2 -0
  25. package/assets/icon-C2JNaLxH.js +1 -0
  26. package/assets/init-user-D2HSyXup.js +1 -0
  27. package/assets/input-error-CH2caTtO.js +1 -0
  28. package/assets/jsoneditor-DVNQmA6G.js +3869 -0
  29. package/assets/list-CFU0-TgN.js +4 -0
  30. package/assets/login-DFSLEO17.js +1 -0
  31. package/assets/manifest.json +246 -273
  32. package/assets/material-icon-Bx9pGQiQ.js +1 -0
  33. package/assets/media-manager-WcKe1EvD.js +6 -0
  34. package/assets/module-CT7PC6pc.js +1 -0
  35. package/assets/monaco-Bl4zdWCn.js +11 -0
  36. package/assets/nav-footer-BiSQkPt4.js +1 -0
  37. package/assets/nav-main-rTH0PfDw.js +1 -0
  38. package/assets/nav-user-Bj6cWs0a.js +1 -0
  39. package/assets/notification-Bi-PX87D.js +20 -0
  40. package/assets/pagination-render-AKJvTIRA.js +1 -0
  41. package/assets/register-BTP4uxsK.js +1 -0
  42. package/assets/ru-eW0WKkga.js +1 -0
  43. package/assets/theme-switcher-Dm8EOGzx.js +1 -0
  44. package/assets/toast-editor-DOg_gvSp.js +668 -0
  45. package/assets/user-filters-list-YUfR4XMI.js +1 -0
  46. package/assets/user-info-BgSbT02v.js +1 -0
  47. package/assets/user-menu-content-TQTXHIv6.js +1 -0
  48. package/assets/{vanilla-picker-l5rcX3cq.js → vanilla-picker-B3LgXoKV.js} +1 -7
  49. package/assets/welcome-vLwTu1R6.js +1 -0
  50. package/controllers/add.d.ts +1 -1
  51. package/controllers/add.js +20 -26
  52. package/controllers/addGroup.d.ts +1 -1
  53. package/controllers/addGroup.js +7 -15
  54. package/controllers/addUser.d.ts +1 -1
  55. package/controllers/addUser.js +10 -16
  56. package/controllers/catalog/Catalog.d.ts +1 -1
  57. package/controllers/catalog/Catalog.js +1 -10
  58. package/controllers/catalog/FrontendCatalogAdapter.d.ts +3 -3
  59. package/controllers/catalog/FrontendCatalogAdapter.js +0 -6
  60. package/controllers/catalog/FrontentCatalogAdapter.d.ts +3 -3
  61. package/controllers/catalog/FrontentCatalogAdapter.js +0 -4
  62. package/controllers/ckeditorUpload.js +2 -18
  63. package/controllers/dashboard.d.ts +1 -1
  64. package/controllers/dashboard.js +2 -5
  65. package/controllers/edit.js +24 -37
  66. package/controllers/editGroup.d.ts +1 -1
  67. package/controllers/editGroup.js +10 -21
  68. package/controllers/editUser.d.ts +1 -1
  69. package/controllers/editUser.js +11 -23
  70. package/controllers/exportData.d.ts +6 -0
  71. package/controllers/exportData.js +315 -0
  72. package/controllers/feed.d.ts +6 -0
  73. package/controllers/feed.js +73 -0
  74. package/controllers/feedback/feedbackController.d.ts +1 -1
  75. package/controllers/feedback/feedbackController.js +5 -7
  76. package/controllers/filter-fields/columns.d.ts +11 -0
  77. package/controllers/filter-fields/columns.js +106 -0
  78. package/controllers/filter-fields/filterFields.d.ts +10 -0
  79. package/controllers/filter-fields/filterFields.js +141 -0
  80. package/controllers/filter-fields/getAllUserFilters.d.ts +6 -0
  81. package/controllers/filter-fields/getAllUserFilters.js +115 -0
  82. package/controllers/filter-fields/groups.d.ts +5 -0
  83. package/controllers/filter-fields/groups.js +26 -0
  84. package/controllers/filter-fields/savedFilters.d.ts +25 -0
  85. package/controllers/filter-fields/savedFilters.js +317 -0
  86. package/controllers/getAllWidgets.d.ts +1 -1
  87. package/controllers/getAllWidgets.js +1 -9
  88. package/controllers/history-actions/HistoryController.js +6 -31
  89. package/controllers/initUser.js +6 -5
  90. package/controllers/inlineUpdate.d.ts +7 -0
  91. package/controllers/inlineUpdate.js +148 -0
  92. package/controllers/list.d.ts +1 -1
  93. package/controllers/list.js +383 -70
  94. package/controllers/listUserFilters.d.ts +5 -0
  95. package/controllers/listUserFilters.js +26 -0
  96. package/controllers/login.js +2 -2
  97. package/controllers/media-manager/mediaManagerApi.js +0 -9
  98. package/controllers/navigation/edit.js +3 -9
  99. package/controllers/notifications/NotificationController.d.ts +1 -1
  100. package/controllers/notifications/NotificationController.js +12 -36
  101. package/controllers/register.js +10 -9
  102. package/controllers/remove.js +10 -19
  103. package/controllers/timezones.d.ts +1 -1
  104. package/controllers/timezones.js +0 -6
  105. package/controllers/userApiKey.d.ts +7 -0
  106. package/controllers/userApiKey.js +36 -0
  107. package/controllers/view.js +14 -26
  108. package/controllers/welcome.d.ts +1 -1
  109. package/controllers/welcome.js +0 -4
  110. package/controllers/widgets/Action.d.ts +1 -1
  111. package/controllers/widgets/Action.js +1 -9
  112. package/controllers/widgets/Custom.d.ts +1 -1
  113. package/controllers/widgets/Custom.js +1 -9
  114. package/controllers/widgets/Info.d.ts +1 -1
  115. package/controllers/widgets/Info.js +1 -9
  116. package/controllers/widgets/filterInfo.d.ts +1 -0
  117. package/controllers/widgets/filterInfo.js +44 -0
  118. package/controllers/widgets/switch.d.ts +1 -1
  119. package/controllers/widgets/switch.js +1 -9
  120. package/controllers/widgetsDB.d.ts +1 -1
  121. package/controllers/widgetsDB.js +2 -8
  122. package/helpers/accessRightsHelper.d.ts +1 -1
  123. package/helpers/accessRightsHelper.js +5 -4
  124. package/helpers/apiKeyHelper.d.ts +5 -0
  125. package/helpers/apiKeyHelper.js +8 -0
  126. package/helpers/configHelper.js +12 -15
  127. package/helpers/controllerHelper.d.ts +14 -21
  128. package/helpers/controllerHelper.js +50 -83
  129. package/helpers/fieldsHelper.js +3 -3
  130. package/helpers/filterDatetimeHelper.d.ts +5 -0
  131. package/helpers/filterDatetimeHelper.js +84 -0
  132. package/helpers/inertiaActionsHelper.d.ts +2 -2
  133. package/helpers/inertiaActionsHelper.js +5 -4
  134. package/helpers/inertiaAddHelper.d.ts +3 -414
  135. package/helpers/inertiaAddHelper.js +39 -15
  136. package/helpers/inertiaGroupHelper.d.ts +2 -2
  137. package/helpers/inertiaGroupHelper.js +3 -3
  138. package/helpers/inertiaListHelper.d.ts +7 -3
  139. package/helpers/inertiaListHelper.js +26 -12
  140. package/helpers/inertiaMenuHelper.d.ts +1 -0
  141. package/helpers/inertiaMenuHelper.js +15 -3
  142. package/helpers/inertiaUserHelper.d.ts +3 -2
  143. package/helpers/inertiaUserHelper.js +7 -3
  144. package/helpers/menuHelper.d.ts +5 -2
  145. package/helpers/menuHelper.js +64 -12
  146. package/helpers/viteHelper.js +1 -2
  147. package/index.d.ts +6 -2
  148. package/index.js +6 -2
  149. package/interfaces/adminpanelConfig.d.ts +126 -39
  150. package/interfaces/internalModelAccess.d.ts +37 -0
  151. package/interfaces/internalModelAccess.js +1 -0
  152. package/interfaces/listQueryBuilder.d.ts +22 -0
  153. package/interfaces/listQueryBuilder.js +1 -0
  154. package/interfaces/queryCriteria.d.ts +54 -0
  155. package/interfaces/queryCriteria.js +1 -0
  156. package/interfaces/types.d.ts +1 -13
  157. package/lib/Adminizer.d.ts +4 -2
  158. package/lib/Adminizer.js +29 -10
  159. package/lib/DataAccessor.d.ts +8 -5
  160. package/lib/DataAccessor.js +89 -42
  161. package/lib/I18n.d.ts +5 -1
  162. package/lib/I18n.js +45 -19
  163. package/lib/MiddlewareManager.d.ts +8 -0
  164. package/lib/MiddlewareManager.js +53 -0
  165. package/lib/ai-assistant/OpenAiModelService.d.ts +3 -3
  166. package/lib/ai-assistant/OpenAiModelService.js +23 -24
  167. package/lib/catalog/Navigation.d.ts +1 -0
  168. package/lib/catalog/Navigation.js +12 -11
  169. package/lib/controls/jsoneditor/JsonEditor.d.ts +1 -2
  170. package/lib/controls/markdown/ToastUiEditor.d.ts +1 -2
  171. package/lib/feedback/FeedbackHandler.js +2 -2
  172. package/lib/filters/ConditionValidator.d.ts +107 -0
  173. package/lib/filters/ConditionValidator.js +483 -0
  174. package/lib/filters/CustomFilterHandler.d.ts +122 -0
  175. package/lib/filters/CustomFilterHandler.js +131 -0
  176. package/lib/filters/FilterCustomFieldHandler.d.ts +2 -0
  177. package/lib/filters/FilterCustomFieldHandler.js +2 -0
  178. package/lib/filters/FilterService.d.ts +82 -0
  179. package/lib/filters/FilterService.js +323 -0
  180. package/lib/filters/index.d.ts +6 -0
  181. package/lib/filters/index.js +4 -0
  182. package/lib/history-actions/AbstractHistoryAdapter.d.ts +5 -4
  183. package/lib/history-actions/AbstractHistoryAdapter.js +45 -30
  184. package/lib/history-actions/DefaultHistoryAdapter.d.ts +2 -0
  185. package/lib/history-actions/DefaultHistoryAdapter.js +12 -6
  186. package/lib/history-actions/HistoryHandler.js +1 -1
  187. package/lib/list-query-builder/ListQueryBuilder.d.ts +117 -0
  188. package/lib/list-query-builder/ListQueryBuilder.js +707 -0
  189. package/lib/media-manager/AbstractMediaManager.d.ts +9 -8
  190. package/lib/media-manager/DefaultMediaManager.d.ts +2 -0
  191. package/lib/media-manager/DefaultMediaManager.js +27 -15
  192. package/lib/media-manager/Items.d.ts +4 -1
  193. package/lib/media-manager/Items.js +62 -59
  194. package/lib/media-manager/MediaManagerHandler.js +1 -1
  195. package/lib/media-manager/helpers/MediaManagerHelper.d.ts +5 -1
  196. package/lib/media-manager/helpers/MediaManagerHelper.js +38 -4
  197. package/lib/model/AbstractModel.d.ts +33 -25
  198. package/lib/model/AbstractModel.js +54 -2
  199. package/lib/model/InternalModelAccessFactory.d.ts +18 -0
  200. package/lib/model/InternalModelAccessFactory.js +82 -0
  201. package/lib/model/ModelHandler.d.ts +6 -0
  202. package/lib/model/ModelHandler.js +14 -0
  203. package/lib/model/adapter/sequelize.d.ts +32 -10
  204. package/lib/model/adapter/sequelize.js +409 -62
  205. package/lib/model/adapter/typeorm.d.ts +62 -0
  206. package/lib/model/adapter/typeorm.js +777 -0
  207. package/lib/model/internalModelAccessToken.d.ts +1 -0
  208. package/lib/model/internalModelAccessToken.js +1 -0
  209. package/lib/model/internalModelRepository.d.ts +3 -0
  210. package/lib/model/internalModelRepository.js +4 -0
  211. package/lib/notifications/AbstractNotificationService.d.ts +3 -0
  212. package/lib/notifications/AbstractNotificationService.js +42 -36
  213. package/lib/notifications/GeneralNotificationService.js +37 -40
  214. package/lib/notifications/SystemNotificationService.js +33 -36
  215. package/lib/requestProcessor.js +0 -3
  216. package/lib/ui-i18n/getUiTranslations.d.ts +1 -0
  217. package/lib/ui-i18n/getUiTranslations.js +3 -0
  218. package/lib/ui-i18n/uiTranslationKeys.d.ts +6 -0
  219. package/lib/ui-i18n/uiTranslationKeys.js +268 -0
  220. package/lib/widgets/widgetHandler.d.ts +7 -2
  221. package/lib/widgets/widgetHandler.js +98 -18
  222. package/models/FilterAP.d.ts +116 -0
  223. package/models/FilterAP.js +68 -0
  224. package/models/FilterColumnAP.d.ts +32 -0
  225. package/models/FilterColumnAP.js +21 -0
  226. package/models/GroupAP.d.ts +1 -1
  227. package/models/HistoryActionsAP.d.ts +3 -3
  228. package/models/MediaManagerMetaAP.d.ts +1 -1
  229. package/models/NavigationAP.d.ts +1 -1
  230. package/models/UserAP.d.ts +6 -1
  231. package/models/UserAP.js +4 -0
  232. package/package.json +39 -32
  233. package/policies/authPolicies.d.ts +12 -0
  234. package/policies/authPolicies.js +104 -0
  235. package/policies/permissionResolvers.d.ts +12 -0
  236. package/policies/permissionResolvers.js +52 -0
  237. package/services/FeedService.d.ts +70 -0
  238. package/services/FeedService.js +334 -0
  239. package/system/Router.d.ts +1 -0
  240. package/system/Router.js +136 -59
  241. package/system/bindAccessRights.js +11 -30
  242. package/system/bindAuthorization.js +18 -18
  243. package/system/bindCors.js +16 -1
  244. package/system/bindCustomFilterHandlers.d.ts +2 -0
  245. package/system/bindCustomFilterHandlers.js +4 -0
  246. package/system/bindInertia.js +18 -61
  247. package/system/bindReqFunctions.js +10 -2
  248. package/system/bindTranslations.js +7 -3
  249. package/system/buildInternalModelAccess.d.ts +4 -0
  250. package/system/buildInternalModelAccess.js +59 -0
  251. package/system/defaults.js +18 -14
  252. package/system/routePolicies.d.ts +2 -0
  253. package/system/routePolicies.js +29 -0
  254. package/translations/en.json +151 -39
  255. package/translations/ru.json +211 -64
  256. package/ui/components/handsontable.js +13 -27
  257. package/ui/components/ui/dialog-stack.js +1 -3
  258. package/ui/components/ui/popover.js +1 -1
  259. package/ui/components/ui/sidebar.js +1 -1
  260. package/assets/RelationDialogStack-D9UVEF9s.js +0 -407
  261. package/assets/RelationDialogStack-DV8OITPR.css +0 -4
  262. package/assets/add-BlvzWQKF.js +0 -1
  263. package/assets/add-group-1Uoq9NWe.js +0 -1
  264. package/assets/add-group-form-B01gwDGu.js +0 -1
  265. package/assets/add-user-BQCAsaRy.js +0 -1
  266. package/assets/add-user-form-Cgwc9JkI.js +0 -1
  267. package/assets/app-DaOMy1nl.css +0 -72
  268. package/assets/app-layout-CAm60qoE.js +0 -1
  269. package/assets/app-shell-QWCtn9ye.js +0 -1
  270. package/assets/app-sidebar-CfaYbnSy.js +0 -1
  271. package/assets/app-sidebar-header-BsPFDhZ8.js +0 -1
  272. package/assets/breadcrumbs-CZZirDj8.js +0 -1
  273. package/assets/catalog-k5myk7fk.js +0 -6
  274. package/assets/dashboard-BkL9ybBw.js +0 -3
  275. package/assets/date-picker-B5AZ_7Q9.js +0 -1
  276. package/assets/del-modal-BoyXZloG.js +0 -1
  277. package/assets/dynamic-controls-k61T9W2P.js +0 -1
  278. package/assets/form-1WGY0YgG.js +0 -1
  279. package/assets/form-DJapG3qF.js +0 -1
  280. package/assets/geo-json-DsMUHo0l.js +0 -4
  281. package/assets/handsontable-PxYdjN8c.js +0 -298
  282. package/assets/history-CluyR-yJ.js +0 -1
  283. package/assets/home-Dug9zBzM.js +0 -2
  284. package/assets/icon-DfDLMG5f.js +0 -1
  285. package/assets/init-user-CF80MEnT.js +0 -1
  286. package/assets/input-error-DuuqFgZa.js +0 -1
  287. package/assets/jsoneditor-De1FvcYu.js +0 -3882
  288. package/assets/list-CuexshNt.js +0 -1
  289. package/assets/list-table-BsEWjTKY.js +0 -22
  290. package/assets/login-eDemYzN-.js +0 -1
  291. package/assets/material-icon-DMT8KdmE.js +0 -1
  292. package/assets/media-manager-DfYa_mT_.js +0 -14
  293. package/assets/module-Cd4Tm6uq.js +0 -1
  294. package/assets/monaco-BhBYtg3d.js +0 -11
  295. package/assets/nav-footer-D3olYxtz.js +0 -1
  296. package/assets/nav-main-BctqyzeV.js +0 -1
  297. package/assets/nav-user-Bn1Lt-BZ.js +0 -1
  298. package/assets/notification-D64qvni-.js +0 -27
  299. package/assets/pagination-render-DxD78ahJ.js +0 -1
  300. package/assets/register-349PwYbe.js +0 -1
  301. package/assets/theme-switcher-DfExsHW2.js +0 -1
  302. package/assets/toast-editor-ESK5iWPx.js +0 -845
  303. package/assets/user-info-DtBK5Kh8.js +0 -1
  304. package/assets/user-menu-content-0XYOCMaA.js +0 -1
  305. package/assets/welcome-PDp-gUei.js +0 -1
  306. package/controllers/form.d.ts +0 -1
  307. package/controllers/form.js +0 -86
  308. package/helpers/formHelper.d.ts +0 -6
  309. package/helpers/formHelper.js +0 -38
  310. package/helpers/inertiaFromHelper.d.ts +0 -11
  311. package/helpers/inertiaFromHelper.js +0 -98
  312. package/helpers/runtimeMode.d.ts +0 -1
  313. package/helpers/runtimeMode.js +0 -3
  314. package/lib/PolicyManager.d.ts +0 -8
  315. package/lib/PolicyManager.js +0 -53
  316. package/lib/datatable/NodeTable.d.ts +0 -49
  317. package/lib/datatable/NodeTable.js +0 -207
  318. package/lib/model/adapter/waterline.d.ts +0 -32
  319. package/lib/model/adapter/waterline.js +0 -180
  320. package/migrations/index.d.ts +0 -3
  321. package/migrations/index.js +0 -4
  322. package/migrations/knex/20250106000001_adminizer_init.d.ts +0 -8
  323. package/migrations/knex/20250106000001_adminizer_init.js +0 -164
  324. package/migrations/umzug/0001.d.ts +0 -7
  325. package/migrations/umzug/0001.js +0 -121
  326. package/migrations/umzugExports.d.ts +0 -2
  327. package/migrations/umzugExports.js +0 -9
  328. package/system/bindForms.d.ts +0 -2
  329. package/system/bindForms.js +0 -20
  330. /package/{policies → middlewares}/addMessages.d.ts +0 -0
  331. /package/{policies → middlewares}/addMessages.js +0 -0
  332. /package/{policies → middlewares}/checkAuth.d.ts +0 -0
  333. /package/{policies → middlewares}/checkAuth.js +0 -0
  334. /package/{policies → middlewares}/setLocale.d.ts +0 -0
  335. /package/{policies → middlewares}/setLocale.js +0 -0
@@ -0,0 +1 @@
1
+ export declare const INTERNAL_MODEL_ACCESS_TOKEN: unique symbol;
@@ -0,0 +1 @@
1
+ export const INTERNAL_MODEL_ACCESS_TOKEN = Symbol("InternalModelAccess");
@@ -0,0 +1,3 @@
1
+ import { InternalModelRepository } from "../../interfaces/internalModelAccess";
2
+ import { AbstractModel } from "./AbstractModel";
3
+ export declare function createInternalModelRepository<T>(modelName: string, model: AbstractModel<T>): InternalModelRepository<T>;
@@ -0,0 +1,4 @@
1
+ import { INTERNAL_MODEL_ACCESS_TOKEN } from "./internalModelAccessToken.js";
2
+ export function createInternalModelRepository(modelName, model) {
3
+ return model.createInternalRepository(INTERNAL_MODEL_ACCESS_TOKEN, modelName);
4
+ }
@@ -56,6 +56,9 @@ export declare abstract class AbstractNotificationService extends EventEmitter {
56
56
  abstract readonly icon: string;
57
57
  abstract readonly iconColor: string;
58
58
  constructor(adminizer: Adminizer);
59
+ protected notificationModel(): import("../..").InternalModelRepository<any>;
60
+ protected userNotificationModel(): import("../..").InternalModelRepository<any>;
61
+ protected userModel(): import("../..").InternalModelRepository<UserAP>;
59
62
  private _bindAccessRight;
60
63
  /**
61
64
  * Registers a client for a user and associates it with a send function.
@@ -53,6 +53,15 @@ export class AbstractNotificationService extends EventEmitter {
53
53
  this.adminizer = adminizer;
54
54
  this._bindAccessRight();
55
55
  }
56
+ notificationModel() {
57
+ return this.adminizer.modelHandler.internal("notifications").get("NotificationAP");
58
+ }
59
+ userNotificationModel() {
60
+ return this.adminizer.modelHandler.internal("notifications").get("UserNotificationAP");
61
+ }
62
+ userModel() {
63
+ return this.adminizer.modelHandler.internal("notifications").get("UserAP");
64
+ }
56
65
  _bindAccessRight() {
57
66
  setTimeout(() => {
58
67
  this.adminizer.accessRightsHelper.registerToken({
@@ -80,7 +89,6 @@ export class AbstractNotificationService extends EventEmitter {
80
89
  // We get the Map of the user's clients and add a new client
81
90
  const userClients = this.clients.get(userId);
82
91
  userClients.set(clientId, sendFn);
83
- Adminizer.log.info(`[${this.notificationClass}] Client ${clientId} connected for user ${userId}. Total users: ${this.clients.size}, user clients: ${userClients.size}`);
84
92
  }
85
93
  /**
86
94
  * Removes a client from the internal tracking structure.
@@ -96,7 +104,6 @@ export class AbstractNotificationService extends EventEmitter {
96
104
  if (userClients.size === 0) {
97
105
  this.clients.delete(userId);
98
106
  }
99
- Adminizer.log.info(`[${this.notificationClass}] Client ${clientId} disconnected from user ${userId}. Total users: ${this.clients.size}`);
100
107
  return;
101
108
  }
102
109
  }
@@ -177,9 +184,9 @@ export class AbstractNotificationService extends EventEmitter {
177
184
  * @returns {Promise<void>} A promise that resolves when the record is created or an error is logged.
178
185
  */
179
186
  async createUserNotification(notificationId, userId) {
180
- if (this.adminizer.modelHandler.model.has('usernotificationap') && userId) {
187
+ if (userId) {
181
188
  try {
182
- await this.adminizer.modelHandler.model.get('usernotificationap')["_create"]({
189
+ await this.userNotificationModel().create({
183
190
  userId: userId,
184
191
  notificationId: notificationId,
185
192
  read: false
@@ -198,18 +205,15 @@ export class AbstractNotificationService extends EventEmitter {
198
205
  * @returns {Promise<any>} A promise that resolves with the found record or null if not found or an error occurs.
199
206
  */
200
207
  async getUserNotification(notificationId, userId) {
201
- if (this.adminizer.modelHandler.model.has('usernotificationap')) {
202
- try {
203
- return await this.adminizer.modelHandler.model.get('usernotificationap')["_findOne"]({
204
- where: { notificationId: notificationId, userId: userId }
205
- });
206
- }
207
- catch (error) {
208
- Adminizer.log.error(`Error getting user notification:`, error);
209
- return null;
210
- }
208
+ try {
209
+ return await this.userNotificationModel().findOne({
210
+ where: { notificationId: notificationId, userId: userId }
211
+ });
212
+ }
213
+ catch (error) {
214
+ Adminizer.log.error(`Error getting user notification:`, error);
215
+ return null;
211
216
  }
212
- return null;
213
217
  }
214
218
  /**
215
219
  * Retrieves a paginated list of notifications for a specific user, optionally filtered by read status.
@@ -220,17 +224,15 @@ export class AbstractNotificationService extends EventEmitter {
220
224
  * @returns {Promise<INotification[]>} A promise that resolves with an array of notification objects.
221
225
  */
222
226
  async getNotifications(userId, limit = 20, skip = 0, unreadOnly = false) {
223
- if (!this.adminizer.modelHandler.model.has('notificationap')) {
224
- return [];
225
- }
226
227
  try {
227
228
  let query = { notificationClass: this.notificationClass };
228
229
  // If notifications are requested for a specific user, we obtain the user's notification ID
229
- const userNotifications = await this.adminizer.modelHandler.model.get('usernotificationap')["_find"]({
230
+ const userNotifications = await this.userNotificationModel().find({
230
231
  where: {
231
232
  userId: userId
232
- }
233
- }, { populate: [['notificationId', {}]] });
233
+ },
234
+ populate: { notificationId: true }
235
+ });
234
236
  const notificationIds = userNotifications.map((un) => un.notificationId.id);
235
237
  if (unreadOnly) {
236
238
  // Only unread
@@ -243,7 +245,7 @@ export class AbstractNotificationService extends EventEmitter {
243
245
  }
244
246
  if (query.id.length === 0)
245
247
  return [];
246
- const notificationsDB = await this.adminizer.modelHandler.model.get('notificationap')["_find"]({
248
+ const notificationsDB = await this.notificationModel().find({
247
249
  where: query,
248
250
  sort: 'createdAt DESC',
249
251
  limit: limit,
@@ -288,15 +290,16 @@ export class AbstractNotificationService extends EventEmitter {
288
290
  */
289
291
  async search(s, userId) {
290
292
  try {
291
- const userNotifications = await this.adminizer.modelHandler.model.get('usernotificationap')["_find"]({
293
+ const userNotifications = await this.userNotificationModel().find({
292
294
  where: {
293
295
  userId: userId
294
- }
295
- }, { populate: [['notificationId', {}]] });
296
+ },
297
+ populate: { notificationId: true }
298
+ });
296
299
  const notificationIds = userNotifications.map((un) => un.notificationId.id);
297
300
  if (notificationIds.length === 0)
298
301
  return [];
299
- const notificationsDB = await this.adminizer.modelHandler.model.get('notificationap')["_find"]({
302
+ const notificationsDB = await this.notificationModel().find({
300
303
  where: {
301
304
  message: { contains: s },
302
305
  id: notificationIds,
@@ -321,8 +324,8 @@ export class AbstractNotificationService extends EventEmitter {
321
324
  try {
322
325
  const userNotification = await this.getUserNotification(id, userId);
323
326
  if (userNotification) {
324
- await this.adminizer.modelHandler.model.get('usernotificationap')["_update"]({
325
- id: userNotification.id
327
+ await this.userNotificationModel().update({
328
+ where: { id: userNotification.id }
326
329
  }, { read: true });
327
330
  }
328
331
  }
@@ -337,11 +340,11 @@ export class AbstractNotificationService extends EventEmitter {
337
340
  */
338
341
  async markAllAsRead(userId) {
339
342
  try {
340
- const userNotifications = await this.adminizer.modelHandler.model.get('usernotificationap')["_find"]({
343
+ const userNotifications = await this.userNotificationModel().find({
341
344
  where: { userId: userId }
342
345
  });
343
346
  for (const userNotification of userNotifications) {
344
- await this.adminizer.modelHandler.model.get('usernotificationap')["_update"]({
347
+ await this.userNotificationModel().update({
345
348
  where: { id: userNotification.id },
346
349
  }, { read: true });
347
350
  }
@@ -372,9 +375,10 @@ export class AbstractNotificationService extends EventEmitter {
372
375
  }
373
376
  // if unreadOnly = false - we get ALL records (both read and not)
374
377
  // We receive all user-notification communications
375
- const userNotifications = await this.adminizer.modelHandler.model.get('usernotificationap')["_find"]({
376
- where: whereClause
377
- }, { populate: [['notificationId', {}]] });
378
+ const userNotifications = await this.userNotificationModel().find({
379
+ where: whereClause,
380
+ populate: { notificationId: true }
381
+ });
378
382
  if (userNotifications.length === 0)
379
383
  return 0;
380
384
  // Filter by notification class using notificationId
@@ -384,9 +388,11 @@ export class AbstractNotificationService extends EventEmitter {
384
388
  if (validNotificationIds.length === 0)
385
389
  return 0;
386
390
  // We recalculate only those whose notificationClass matches
387
- return await this.adminizer.modelHandler.model.get('notificationap')["_count"]({
388
- id: validNotificationIds,
389
- notificationClass: this.notificationClass
391
+ return await this.notificationModel().count({
392
+ where: {
393
+ id: validNotificationIds,
394
+ notificationClass: this.notificationClass
395
+ }
390
396
  });
391
397
  }
392
398
  catch (error) {
@@ -11,51 +11,48 @@ export class GeneralNotificationService extends AbstractNotificationService {
11
11
  notificationClass: this.notificationClass
12
12
  };
13
13
  let notificationDB;
14
- // Save to the database
15
- if (this.adminizer.modelHandler.model.has('notificationap')) {
16
- try {
17
- notificationDB = await this.adminizer.modelHandler.model.get('notificationap')["_create"](fullNotification);
18
- if (notification.userId) {
19
- // For specific user
20
- await this.createUserNotification(notificationDB.id, notification.userId);
21
- }
22
- else {
23
- // For all users
24
- const users = await this.adminizer.modelHandler.model.get('userap')["_find"]({});
25
- for (const user of users) {
26
- try {
27
- if (this.adminizer.accessRightsHelper.hasPermission(`notification-${this.notificationClass}`, user)) {
28
- await this.createUserNotification(notificationDB.id, user.id);
29
- }
30
- else {
31
- Adminizer.log.error(`[${this.notificationClass}] User ${user.id} doesn't have permission to receive this notification`);
32
- }
14
+ try {
15
+ notificationDB = await this.notificationModel().create(fullNotification);
16
+ if (notification.userId) {
17
+ // For specific user
18
+ await this.createUserNotification(notificationDB.id, notification.userId);
19
+ }
20
+ else {
21
+ // For all users
22
+ const users = await this.userModel().find({});
23
+ for (const user of users) {
24
+ try {
25
+ if (this.adminizer.accessRightsHelper.hasPermission(`notification-${this.notificationClass}`, user)) {
26
+ await this.createUserNotification(notificationDB.id, user.id);
33
27
  }
34
- catch (error) {
35
- Adminizer.log.error('Error creating UserNotificationAP:', error);
28
+ else {
29
+ Adminizer.log.warn(`[${this.notificationClass}] User ${user.id} doesn't have permission to receive this notification`);
36
30
  }
37
31
  }
32
+ catch (error) {
33
+ Adminizer.log.error('Error creating UserNotificationAP:', error);
34
+ }
38
35
  }
39
- const event = {
40
- type: 'notification',
41
- data: {
42
- ...notificationDB,
43
- read: false,
44
- icon: {
45
- icon: this.icon,
46
- iconColor: this.iconColor
47
- },
48
- },
49
- notificationClass: this.notificationClass,
50
- userId: notification.userId ?? null
51
- };
52
- this.broadcast(event);
53
- Adminizer.log.info(`[General] Notification dispatched: ${fullNotification.title}`);
54
- return true;
55
- }
56
- catch (error) {
57
- Adminizer.log.error('Error saving notification to database:', error);
58
36
  }
37
+ const event = {
38
+ type: 'notification',
39
+ data: {
40
+ ...notificationDB,
41
+ read: false,
42
+ icon: {
43
+ icon: this.icon,
44
+ iconColor: this.iconColor
45
+ },
46
+ },
47
+ notificationClass: this.notificationClass,
48
+ userId: notification.userId ?? null
49
+ };
50
+ this.broadcast(event);
51
+ Adminizer.log.info(`[General] Notification dispatched: ${fullNotification.title}`);
52
+ return true;
53
+ }
54
+ catch (error) {
55
+ Adminizer.log.error('Error saving notification to database:', error);
59
56
  }
60
57
  return false;
61
58
  }
@@ -14,47 +14,44 @@ export class SystemNotificationService extends AbstractNotificationService {
14
14
  channel: notification.channel ?? ''
15
15
  };
16
16
  let notificationDB;
17
- // Save to the database
18
- if (this.adminizer.modelHandler.model.has('notificationap')) {
19
- try {
20
- notificationDB = await this.adminizer.modelHandler.model.get('notificationap')["_create"](fullNotification);
21
- const users = await this.adminizer.modelHandler.model.get('userap')["_find"]({});
22
- for (const user of users) {
23
- try {
24
- if (this.adminizer.accessRightsHelper.hasPermission(`notification-${this.notificationClass}`, user)) {
25
- await this.createUserNotification(notificationDB.id, user.id);
26
- }
27
- }
28
- catch (error) {
29
- Adminizer.log.error('Error creating UserNotificationAP:', error);
17
+ try {
18
+ notificationDB = await this.notificationModel().create(fullNotification);
19
+ const users = await this.userModel().find({});
20
+ for (const user of users) {
21
+ try {
22
+ if (this.adminizer.accessRightsHelper.hasPermission(`notification-${this.notificationClass}`, user)) {
23
+ await this.createUserNotification(notificationDB.id, user.id);
30
24
  }
31
25
  }
32
- const event = {
33
- type: 'notification',
34
- data: {
35
- ...notificationDB,
36
- icon: {
37
- icon: this.icon,
38
- iconColor: this.iconColor
39
- },
40
- },
41
- notificationClass: this.notificationClass,
42
- userId: notification.userId ?? null,
43
- channel: notification.channel ?? 'system'
44
- };
45
- // Send to all channels or to a specific channel
46
- if (notification.channel) {
47
- this.broadcastToChannel(notification.channel, event);
48
- }
49
- else {
50
- this.broadcastToChannel('system', event);
26
+ catch (error) {
27
+ Adminizer.log.error('Error creating UserNotificationAP:', error);
51
28
  }
52
- Adminizer.log.info(`[System] Notification dispatched: ${fullNotification.title}`);
53
- return true;
54
29
  }
55
- catch (error) {
56
- Adminizer.log.error('Error saving system notification to database:', error);
30
+ const event = {
31
+ type: 'notification',
32
+ data: {
33
+ ...notificationDB,
34
+ icon: {
35
+ icon: this.icon,
36
+ iconColor: this.iconColor
37
+ },
38
+ },
39
+ notificationClass: this.notificationClass,
40
+ userId: notification.userId ?? null,
41
+ channel: notification.channel ?? 'system'
42
+ };
43
+ // Send to all channels or to a specific channel
44
+ if (notification.channel) {
45
+ this.broadcastToChannel(notification.channel, event);
46
+ }
47
+ else {
48
+ this.broadcastToChannel('system', event);
57
49
  }
50
+ Adminizer.log.info(`[System] Notification dispatched: ${fullNotification.title}`);
51
+ return true;
52
+ }
53
+ catch (error) {
54
+ Adminizer.log.error('Error saving system notification to database:', error);
58
55
  }
59
56
  return false;
60
57
  }
@@ -29,9 +29,6 @@ export class RequestProcessor {
29
29
  }
30
30
  for (let key in postParams) {
31
31
  let field = fields[key];
32
- if (key === 'sort') {
33
- console.log(fields[key], key, postParams[key]);
34
- }
35
32
  // if (field.model.type === 'boolean') {
36
33
  // postParams[key] = ['true', '1', 'yes', "TRUE", "on"].includes(postParams[key].toString().toLowerCase());
37
34
  // continue;
@@ -0,0 +1 @@
1
+ export declare function getUiTranslations(req: ReqType, keys: readonly string[]): Record<string, string>;
@@ -0,0 +1,3 @@
1
+ export function getUiTranslations(req, keys) {
2
+ return Object.fromEntries(keys.map((key) => [key, req.i18n.__(key)]));
3
+ }
@@ -0,0 +1,6 @@
1
+ export declare const COMMON_UI_TRANSLATION_KEYS: readonly ["Delete", "Diff", "Preview", "Add", "Search", "Yes", "No", "On", "Off", "Hide", "Show", "No notifications found", "No notifications", "No widgets found", "Changes not found", "Old", "New", "Added", "Removed", "Updated", "changed type", "Error: Invalid field data", "Error: Fields data is invalid", "No fields to display", "Error: Some fields are missing required properties (name, type, label)", "Edit", "create", "Clean", "Are you sure?", "Select Item type", "Select Ids", "Open in a new window", "Visible", "Performing an action...", "Action completed", "Save", "First", "Last", "Previous", "Next", "Send feedback", "Feedback", "Title", "Description", "Attach files", "Send", "Sending...", "Feedback sent successfully", "Title is required", "File size exceeds the 5 MB limit", "Remove file", "Max 5 MB per file", "View All", "Make read", "Make all read", "Message", "Date", "Watch", "Current", "There is no history"];
2
+ export declare const FILTER_UI_TRANSLATION_KEYS: readonly ["Filters", "Saved filters", "Active filter", "Add filter", "Reset filter", "Reset", "Equal", "Not equal", "Contains", "Not contains", "Starts with", "Ends with", "Is empty", "Is not empty", "Greater than", "Greater or equal", "Less than", "Less or equal", "Between", "After", "After or equal", "Before", "Before or equal", "In list", "Not in list", "Is null", "Is not null", "Yes", "No", "From", "To", "From...", "To...", "Date...", "Today", "Month", "Month range", "Year", "Year range", "Value...", "Select...", "selected", "Search...", "No results", "Error", "Model not found", "Error applying filter", "Enter filter name", "Temporary filter", "Error: model not found", "Error loading columns", "Network error", "Columns settings", "Available columns", "Visible columns", "Add all", "Hide all", "No available columns", "Move columns here", "Save changes", "Apply", "Save", "Back", "Cancel", "conditions", "modified", "Private filter", "For groups", "Public filter", "Only for you", "For selected groups", "For all users", "Visible only to you", "Visible only to your group", "API access (feed)", "Hide", "Show", "Regenerate", "copied to clipboard", "Failed to copy", "Loading filters...", "No saved filters", "Save current filter for quick access", "Someone else's private filter (owner:", "unknown)", "Owner", "Apply filter", "Delete filter", "No permission to delete filter", "Edit filter", "New filter", "Filter conditions", "Add condition", "Select field", "No conditions. Add a condition above.", "Name", "Description", "Icon", "Color", "Filter parameters", "Change filter conditions and parameters", "Configure filter conditions", "Specify name and parameters for saving", "Someone else's private filter", "You cannot change someone else's filter visibility", "Private", "Public", "Visibility", "Export", "Exporting...", "Export is only available with an active filter", "Export to", "completed", "Export error", "Data in JSON format", "Text format CSV", "Excel file", "Conditions", "Access for groups", "Selected groups", "Groups list", "Columns", "Saving...", "Error saving filter", "Column configuration", "Select and arrange columns to display in the table", "Loading columns...", "Use buttons", "to move and", "to change order", "Add", "Edit", "Save filter", "and", "Custom filtering", "Select a saved filter or create a new one", "Select a filter or create a new one", "Filter visibility", "Unknown", "JSON URL", "XML URL", "API key is not created", "The key is not created. Create it or contact an administrator.", "OK"];
3
+ export declare const HISTORY_UI_TRANSLATION_KEYS: readonly ["Models", "All", "Users", "Date", "Pick a date", "Search", "Reset", "Model", "Name", "Event", "User", "Diff", "The end of the list has been reached", "There are no records to display"];
4
+ export declare const HISTORY_TABLE_UI_TRANSLATION_KEYS: readonly ["Event", "Date", "User", "Watch", "Current", "There is no history", "Diff"];
5
+ export declare const NOTIFICATION_UI_TRANSLATION_KEYS: readonly ["Make read", "View All", "Search", "Make all read", "Title", "Message", "Date", "Diff", "No notifications", "No notifications found", "The end of the list has been reached"];
6
+ export declare const USER_FILTERS_UI_TRANSLATION_KEYS: readonly ["Loading...", "Search filters...", "All models", "No filters found", "Loading more...", "Filter Name", "Model", "Visibility", "API access (feed)", "Owner", "Private", "Public", "Groups", "Yes", "No", "You", "Unknown", "Reset", "found", "User Filters"];