adminizer 4.1.0-build.3 → 4.1.0-build.30

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 (249) hide show
  1. package/Readme.md +11 -1
  2. package/assets/{VanillaJSONEditor-FUe77pIA.js → VanillaJSONEditor-DKF_Ft1S.js} +96 -96
  3. package/assets/add-BA0ZgbVP.js +1 -0
  4. package/assets/add-form-D5PNdz6X.js +1 -0
  5. package/assets/add-group-BqvmQRDY.js +1 -0
  6. package/assets/{add-group-form-dzadPSfL.js → add-group-form-D1P6v9Fm.js} +1 -1
  7. package/assets/add-user-C31g3pXW.js +1 -0
  8. package/assets/add-user-form-DyczuE4l.js +1 -0
  9. package/assets/{app-DMmad2-f.css → app-ClS67l37.css} +1 -1
  10. package/assets/app-layout-CQTlWDgg.js +1 -0
  11. package/assets/{app-shell-BWMRMkHM.js → app-shell-B4pzTbiN.js} +1 -1
  12. package/assets/app-sidebar-DX9Shcd3.js +1 -0
  13. package/assets/{app-sidebar-header-DLAFi13E.js → app-sidebar-header-BcZ0JSSJ.js} +1 -1
  14. package/assets/app.js +9 -9
  15. package/assets/{breadcrumbs-CQNon4Vl.js → breadcrumbs-DIhfOCvh.js} +1 -1
  16. package/assets/{button-CQ9t1kLz.js → button-DleSKY4-.js} +1 -1
  17. package/assets/catalog-BHbLV-zr.js +12 -0
  18. package/assets/catalog-CZUI8zho.css +1 -0
  19. package/assets/{checkbox-W0nGAXIj.js → checkbox-DgmLwxEt.js} +1 -1
  20. package/assets/{compiler-runtime-tM4jBQ-T.js → compiler-runtime-CMDe02AS.js} +1 -1
  21. package/assets/dashboard-BOltB2Hq.css +1 -0
  22. package/assets/dashboard-BiycZ-vC.js +3 -0
  23. package/assets/{date-picker-B__dVVqj.js → date-picker-Cb6A4Zx_.js} +1 -1
  24. package/assets/dialog-stack-DU4Ow4Oa.js +1 -0
  25. package/assets/{dropdown-menu-SEBnEIiL.js → dropdown-menu-D3vlxbLx.js} +1 -1
  26. package/assets/{field-renderer-CapylJU9.js → field-renderer-CW8TLtlI.js} +3 -3
  27. package/assets/form-CLP53RtV.js +1 -0
  28. package/assets/form-CwSId-Cu.js +1 -0
  29. package/assets/{geo-json-CwteYDGB.js → geo-json-BNgLxoVs.js} +1 -1
  30. package/assets/group-add-Brshb-tH.js +1 -0
  31. package/assets/{handsontable-BCnjOpBr.js → handsontable-BI4C0OBe.js} +1 -1
  32. package/assets/home-BRJ6eKVn.js +2 -0
  33. package/assets/{icon-Bz9BMaD0.js → icon-DLHMhF_-.js} +1 -1
  34. package/assets/{index-BcE9FUM6.js → index-BRQOFOzQ.js} +1 -1
  35. package/assets/{index-C0SL3SHw.js → index-BZZx7KCI.js} +1 -1
  36. package/assets/{index-DTRTjOmh.js → index-BpVWRzP4.js} +2 -2
  37. package/assets/{index-BbXEMx9n.js → index-Bz0y23v2.js} +1 -1
  38. package/assets/index-C148XJoK.js +1 -0
  39. package/assets/index-C8anOJBB.js +1 -0
  40. package/assets/{index-DEk3sC8d.js → index-CS5ssiKu.js} +1 -1
  41. package/assets/index-CsMwA9pu.js +1 -0
  42. package/assets/{index-DrWfGwtf.js → index-HZzILD42.js} +1 -1
  43. package/assets/{index-BC0yfOHo.js → index-kzaPFHKt.js} +1 -1
  44. package/assets/{init-user-D9mW-g14.js → init-user-VMPNdivw.js} +1 -1
  45. package/assets/{input-DF7Ue23C.js → input-CZTX-THl.js} +1 -1
  46. package/assets/{input-error-BBygona6.js → input-error-DpUrcJaR.js} +1 -1
  47. package/assets/item-add-1duKvWXz.js +1 -0
  48. package/assets/{label-Z506NKsW.js → label-B1wVTLjK.js} +1 -1
  49. package/assets/list-C07llS61.js +1 -0
  50. package/assets/{list-table-DB1sEQLF.js → list-table-Bh8E-zkN.js} +11 -16
  51. package/assets/{login-DrGaTWhY.js → login-Dl59_ycU.js} +1 -1
  52. package/assets/manifest.json +735 -564
  53. package/assets/{material-icon-CItZiB53.js → material-icon-C9IuCi5R.js} +1 -1
  54. package/assets/module-DwX7rlQ2.js +1 -0
  55. package/assets/{monaco-editor-DqAqwxw4.js → monaco-editor-DjLNSn-O.js} +1 -1
  56. package/assets/{multi-select-oabtVhUP.js → multi-select-CvcWwfki.js} +2 -2
  57. package/assets/{nav-footer-CM-yHiRs.js → nav-footer-C7_pEHmX.js} +1 -1
  58. package/assets/{nav-main-Q3xofGRT.js → nav-main-CwwCPIYf.js} +1 -1
  59. package/assets/{nav-user-Ds8i0Pa2.js → nav-user-K0xXPEmb.js} +1 -1
  60. package/assets/{pagination-render-B57pOpFy.js → pagination-render-BYBw11L4.js} +1 -1
  61. package/assets/pencil-CewBKDRo.js +6 -0
  62. package/assets/{popover-I249Gg2O.js → popover-vHKm7zkm.js} +1 -1
  63. package/assets/{register-C9FQIDtS.js → register-CRsK6KgL.js} +1 -1
  64. package/assets/{select-D1N8zRPY.js → select-Bs9mijkr.js} +2 -2
  65. package/assets/{sidebar-4D-sX2l4.js → sidebar-DflSp1X1.js} +2 -2
  66. package/assets/skeleton-C6UluiCK.js +1 -0
  67. package/assets/{sonner-Dzckw3U3.js → sonner-Cn7ueXZc.js} +1 -1
  68. package/assets/{toast-editor-FbrFd1ft.js → toast-editor-FNxkBiFw.js} +1 -1
  69. package/assets/{tooltip-D2ehgLlB.js → tooltip-BlR1mf2V.js} +1 -1
  70. package/assets/{use-appearance-Co6mO0dV.js → use-appearance-CL1-5ZfQ.js} +1 -1
  71. package/assets/{use-window-size-B8l6Bpkf.js → use-window-size-ciZdUHrJ.js} +1 -1
  72. package/assets/{user-info-DBYoAJYJ.js → user-info-qduQAMOl.js} +2 -2
  73. package/assets/{user-menu-content-qkvdkUVd.js → user-menu-content-Cjq658jE.js} +2 -2
  74. package/assets/welcome-CbHEVD33.js +1 -0
  75. package/controllers/add.js +9 -10
  76. package/controllers/addGroup.js +2 -4
  77. package/controllers/addUser.js +4 -6
  78. package/controllers/catalog/Catalog.d.ts +1 -1
  79. package/controllers/catalog/Catalog.js +42 -34
  80. package/controllers/catalog/FrontentCatalogAdapter.d.ts +43 -21
  81. package/controllers/catalog/FrontentCatalogAdapter.js +49 -30
  82. package/controllers/ckeditorUpload.js +2 -3
  83. package/controllers/dashboard.js +16 -2
  84. package/controllers/edit.js +4 -5
  85. package/controllers/editGroup.js +2 -4
  86. package/controllers/editUser.js +3 -5
  87. package/controllers/form.js +2 -3
  88. package/controllers/getAllWidgets.js +3 -3
  89. package/controllers/initUser.js +1 -2
  90. package/controllers/list.js +6 -6
  91. package/controllers/login.js +31 -15
  92. package/controllers/media-manager/mediaManagerAdapter.js +1 -2
  93. package/controllers/media-manager/mediaManagerApi.js +2 -2
  94. package/controllers/navigation/edit.js +2 -2
  95. package/controllers/register.js +1 -4
  96. package/controllers/remove.js +3 -3
  97. package/controllers/timezones.js +1 -1
  98. package/controllers/view.js +3 -3
  99. package/controllers/welcome.js +1 -1
  100. package/controllers/widgets/Action.js +2 -2
  101. package/controllers/widgets/Custom.js +2 -2
  102. package/controllers/widgets/Info.js +2 -2
  103. package/controllers/widgets/switch.js +2 -2
  104. package/controllers/widgetsDB.js +5 -5
  105. package/helpers/JsUtils.d.ts +1 -0
  106. package/helpers/JsUtils.js +3 -0
  107. package/helpers/accessRightsHelper.d.ts +6 -2
  108. package/helpers/accessRightsHelper.js +26 -3
  109. package/helpers/configHelper.js +2 -1
  110. package/helpers/controllerHelper.js +1 -1
  111. package/helpers/fieldsHelper.d.ts +4 -3
  112. package/helpers/fieldsHelper.js +5 -1
  113. package/helpers/inertiaActionsHelper.js +1 -1
  114. package/helpers/inertiaAddHelper.d.ts +3 -4
  115. package/helpers/inertiaAddHelper.js +27 -7
  116. package/helpers/inertiaFromHelper.js +2 -0
  117. package/helpers/inertiaGroupHelper.d.ts +4 -2
  118. package/helpers/inertiaGroupHelper.js +1 -1
  119. package/helpers/inertiaListHelper.js +5 -5
  120. package/helpers/inertiaMenuHelper.d.ts +1 -1
  121. package/helpers/inertiaMenuHelper.js +2 -2
  122. package/helpers/inertiaUserHelper.d.ts +7 -1
  123. package/helpers/inertiaUserHelper.js +5 -1
  124. package/helpers/menuHelper.d.ts +4 -3
  125. package/helpers/menuHelper.js +22 -15
  126. package/index.d.ts +5 -3
  127. package/index.js +8 -3
  128. package/interfaces/adminpanelConfig.d.ts +28 -31
  129. package/interfaces/global.d.ts +10 -28
  130. package/interfaces/types.d.ts +1 -1
  131. package/lib/Adminizer.d.ts +4 -2
  132. package/lib/Adminizer.js +32 -10
  133. package/lib/media-manager/AbstractMediaManager.d.ts +2 -2
  134. package/lib/media-manager/AbstractMediaManager.js +1 -1
  135. package/lib/media-manager/Items.js +0 -3
  136. package/lib/requestProcessor.js +10 -3
  137. package/lib/v4/DataAccessor.d.ts +5 -2
  138. package/lib/v4/DataAccessor.js +44 -19
  139. package/lib/v4/I18n.js +2 -0
  140. package/lib/v4/POWCaptcha.js +0 -1
  141. package/lib/v4/PolicyManager.js +0 -1
  142. package/lib/{catalog → v4/catalog}/AbstractCatalog.d.ts +87 -31
  143. package/lib/{catalog → v4/catalog}/AbstractCatalog.js +38 -34
  144. package/lib/v4/catalog/Navigation.d.ts +43 -0
  145. package/lib/v4/catalog/Navigation.js +462 -0
  146. package/lib/{controls → v4/controls}/AbstractControls.d.ts +1 -1
  147. package/lib/{controls → v4/controls}/codeEditor/MonacoEditor.d.ts +1 -1
  148. package/lib/{controls → v4/controls}/geojsoneditor/GeoEditor.d.ts +1 -1
  149. package/lib/{controls → v4/controls}/jsoneditor/JsonEditor.d.ts +1 -1
  150. package/lib/{controls → v4/controls}/markdown/ToastUiEditor.d.ts +1 -1
  151. package/lib/{controls → v4/controls}/table/Handsontable.d.ts +1 -1
  152. package/lib/{controls → v4/controls}/wysiwyg/CKeditor.d.ts +1 -1
  153. package/lib/{datatable → v4/datatable}/NodeTable.d.ts +3 -3
  154. package/lib/{datatable → v4/datatable}/NodeTable.js +8 -8
  155. package/lib/v4/helper/jwt.d.ts +10 -0
  156. package/lib/v4/helper/jwt.js +18 -0
  157. package/lib/{inertia → v4/inertia}/inertiaAdapter.js +0 -1
  158. package/lib/v4/model/AbstractModel.d.ts +5 -1
  159. package/lib/v4/model/AbstractModel.js +2 -3
  160. package/lib/v4/model/ModelHandler.js +1 -1
  161. package/lib/v4/model/adapter/sequelize.d.ts +11 -2
  162. package/lib/v4/model/adapter/sequelize.js +451 -118
  163. package/lib/v4/model/adapter/waterline.js +5 -3
  164. package/lib/{widgets → v4/widgets}/abstractAction.d.ts +1 -1
  165. package/lib/v4/widgets/abstractCustom.d.ts +28 -0
  166. package/lib/v4/widgets/abstractCustom.js +9 -0
  167. package/lib/{widgets → v4/widgets}/abstractInfo.d.ts +1 -1
  168. package/lib/{widgets → v4/widgets}/abstractInfo.js +1 -1
  169. package/lib/{widgets → v4/widgets}/abstractLink.d.ts +2 -1
  170. package/lib/{widgets → v4/widgets}/abstractSwitch.d.ts +1 -1
  171. package/lib/{widgets → v4/widgets}/abstractWidgetBase.d.ts +2 -2
  172. package/lib/{widgets → v4/widgets}/widgetHandler.d.ts +29 -5
  173. package/lib/{widgets → v4/widgets}/widgetHandler.js +25 -25
  174. package/models/GroupAP.d.ts +8 -0
  175. package/models/NavigationAP.d.ts +7 -3
  176. package/models/NavigationAP.js +5 -6
  177. package/models/UserAP.d.ts +24 -2
  178. package/models/UserAP.js +2 -2
  179. package/package.json +25 -13
  180. package/policies/checkAuth.js +4 -3
  181. package/policies/setLocale.js +2 -2
  182. package/system/Router.js +8 -16
  183. package/system/bindAccessRights.js +0 -4
  184. package/system/bindAuthorization.js +4 -5
  185. package/system/bindControls.js +6 -6
  186. package/system/bindDev.js +1 -0
  187. package/system/bindInertia.js +12 -11
  188. package/system/bindMediaManager.js +0 -1
  189. package/system/bindModels.js +7 -2
  190. package/system/bindNavigation.d.ts +2 -0
  191. package/system/bindNavigation.js +42 -42
  192. package/system/bindReqFunctions.js +15 -0
  193. package/translations/ru.json +17 -8
  194. package/assets/add-ZITr43GJ.js +0 -1
  195. package/assets/add-form-CYOfr0Ef.js +0 -1
  196. package/assets/add-group-B332wN8K.js +0 -1
  197. package/assets/add-user-TC-mYdsB.js +0 -1
  198. package/assets/add-user-form-y2f_1_lM.js +0 -1
  199. package/assets/app-layout-D1m9Kvxq.js +0 -1
  200. package/assets/app-sidebar-BCtaEFGb.js +0 -1
  201. package/assets/dashboard-BR602KhL.js +0 -1
  202. package/assets/form-DOUNk3o2.js +0 -1
  203. package/assets/form-lOKv4Qbw.js +0 -1
  204. package/assets/home-Ch6QfTIt.js +0 -2
  205. package/assets/index-Cdb9ACvz.js +0 -1
  206. package/assets/index-K81GbF6O.js +0 -1
  207. package/assets/list-Qyd7ecQH.js +0 -1
  208. package/assets/module-DBaykv8l.js +0 -1
  209. package/assets/welcome-D2adQ8EU.js +0 -1
  210. package/controllers/processInstallFinalize.d.ts +0 -1
  211. package/controllers/processInstallFinalize.js +0 -16
  212. package/controllers/processInstallStep.d.ts +0 -1
  213. package/controllers/processInstallStep.js +0 -132
  214. package/lib/catalog/Navigation.d.ts +0 -0
  215. package/lib/catalog/Navigation.js +0 -532
  216. package/lib/installStepper/InstallStepAbstract.d.ts +0 -52
  217. package/lib/installStepper/InstallStepAbstract.js +0 -69
  218. package/lib/installStepper/finalizeStep.d.ts +0 -21
  219. package/lib/installStepper/finalizeStep.js +0 -48
  220. package/lib/installStepper/installStepper.d.ts +0 -40
  221. package/lib/installStepper/installStepper.js +0 -195
  222. package/lib/widgets/abstractCustom.d.ts +0 -13
  223. package/lib/widgets/abstractCustom.js +0 -3
  224. package/models/MediaManagerAP.d.ts +0 -46
  225. package/models/MediaManagerAP.js +0 -45
  226. package/models/MediaManagerAssociationsAP.d.ts +0 -28
  227. package/models/MediaManagerAssociationsAP.js +0 -27
  228. package/models/MediaManagerMetaAP.d.ts +0 -22
  229. package/models/MediaManagerMetaAP.js +0 -21
  230. package/system/bindInstallStepper.d.ts +0 -2
  231. package/system/bindInstallStepper.js +0 -23
  232. /package/lib/{catalog → v4/catalog}/CatalogHandler.d.ts +0 -0
  233. /package/lib/{catalog → v4/catalog}/CatalogHandler.js +0 -0
  234. /package/lib/{controls → v4/controls}/AbstractControls.js +0 -0
  235. /package/lib/{controls → v4/controls}/ControlsHandler.d.ts +0 -0
  236. /package/lib/{controls → v4/controls}/ControlsHandler.js +0 -0
  237. /package/lib/{controls → v4/controls}/codeEditor/MonacoEditor.js +0 -0
  238. /package/lib/{controls → v4/controls}/geojsoneditor/GeoEditor.js +0 -0
  239. /package/lib/{controls → v4/controls}/jsoneditor/JsonEditor.js +0 -0
  240. /package/lib/{controls → v4/controls}/markdown/ToastUiEditor.js +0 -0
  241. /package/lib/{controls → v4/controls}/table/Handsontable.js +0 -0
  242. /package/lib/{controls → v4/controls}/wysiwyg/CKeditor.js +0 -0
  243. /package/lib/{inertia → v4/inertia}/flash.d.ts +0 -0
  244. /package/lib/{inertia → v4/inertia}/flash.js +0 -0
  245. /package/lib/{inertia → v4/inertia}/inertiaAdapter.d.ts +0 -0
  246. /package/lib/{widgets → v4/widgets}/abstractAction.js +0 -0
  247. /package/lib/{widgets → v4/widgets}/abstractLink.js +0 -0
  248. /package/lib/{widgets → v4/widgets}/abstractSwitch.js +0 -0
  249. /package/lib/{widgets → v4/widgets}/abstractWidgetBase.js +0 -0
@@ -84,7 +84,7 @@ export class ControllerHelper {
84
84
  const entityType = req.params.entityType;
85
85
  if (!entityType) {
86
86
  const extractedEntityType = req.originalUrl.split('/')[2];
87
- if (["form", "model", "wizard"].includes(extractedEntityType)) {
87
+ if (["form", "model"].includes(extractedEntityType)) {
88
88
  return extractedEntityType;
89
89
  }
90
90
  else {
@@ -1,20 +1,21 @@
1
- import { ActionType, BaseFieldConfig, FieldsTypes } from "../interfaces/adminpanelConfig";
1
+ import { ActionType, BaseFieldConfig, FieldsTypes, ModelConfig } from "../interfaces/adminpanelConfig";
2
2
  import { Attribute } from "../lib/v4/model/AbstractModel";
3
3
  export type Field = {
4
4
  config: BaseFieldConfig & {
5
5
  /** @deprecated record should not be in config anymore */
6
- records?: object[];
6
+ records?: Record<string, any>[];
7
7
  file?: string;
8
8
  key?: string;
9
9
  required?: boolean;
10
10
  type?: FieldsTypes;
11
11
  groupsAccessRights?: string[];
12
12
  } | string | boolean;
13
- /** for populated fields' configs */
13
+ /** For render associalitons fields */
14
14
  populated: {
15
15
  [key: string]: Field;
16
16
  } | undefined;
17
17
  model: Attribute;
18
+ modelConfig: ModelConfig;
18
19
  };
19
20
  export type Fields = {
20
21
  [key: string]: Field;
@@ -1,5 +1,6 @@
1
1
  import { DataAccessor } from "../lib/v4/DataAccessor";
2
2
  import { Adminizer } from "../lib/Adminizer";
3
+ import { isObject } from "./JsUtils";
3
4
  export class FieldsHelper {
4
5
  /**
5
6
  * Load list of records for all associations into `fields`
@@ -20,6 +21,9 @@ export class FieldsHelper {
20
21
  */
21
22
  let loadAssoc = async function (key, action) {
22
23
  let fieldConfigConfig = fields[key].config;
24
+ if (!isObject(fieldConfigConfig)) {
25
+ throw 'type error: fieldConfigConfig should be normalized';
26
+ }
23
27
  if (fieldConfigConfig.type !== 'association' && fieldConfigConfig.type !== 'association-many') {
24
28
  return;
25
29
  }
@@ -42,7 +46,7 @@ export class FieldsHelper {
42
46
  name: modelName, config: req.adminizer.config.models[modelName],
43
47
  model: Model, uri: `${req.adminizer.config.routePrefix}/model/${modelName}`, type: "model"
44
48
  };
45
- let dataAccessor = new DataAccessor(req, entity, action);
49
+ let dataAccessor = new DataAccessor(req.adminizer, req.user, entity, "view");
46
50
  list = await Model.find({}, dataAccessor);
47
51
  }
48
52
  catch (e) {
@@ -4,7 +4,7 @@ export default function inertiaActionsHelper(actionType, entity, req) {
4
4
  const actions = req.adminizer.menuHelper.getGlobalActions(entity.config, actionType);
5
5
  if (actions && actions.length > 0) {
6
6
  actions.forEach(function (action) {
7
- if (req.adminizer.accessRightsHelper.hasPermission(action.accessRightsToken, req.session.UserAP)) {
7
+ if (req.adminizer.accessRightsHelper.hasPermission(action.accessRightsToken, req.user)) {
8
8
  resActions.push({
9
9
  link: action.link,
10
10
  id: action.id,
@@ -1,8 +1,7 @@
1
1
  import { Entity, PropsField } from "../interfaces/types";
2
2
  import { Actions } from "./inertiaActionsHelper";
3
- import { Fields } from "./fieldsHelper";
4
- import { BaseFieldConfig } from "../interfaces/adminpanelConfig";
5
- import { AbstractControls, ControlType } from "../lib/controls/AbstractControls";
3
+ import { Fields, Field } from "./fieldsHelper";
4
+ import { AbstractControls, ControlType } from "../lib/v4/controls/AbstractControls";
6
5
  export type PropsFieldType = 'text' | 'number' | 'range' | 'week' | 'month' | 'email' | 'color' | 'time' | 'date' | 'datetime-local' | 'password' | 'select' | 'select-many' | 'association-many' | 'association' | 'textarea' | 'checkbox' | ControlType;
7
6
  interface FieldProps extends Record<string | number | symbol, unknown> {
8
7
  edit: boolean;
@@ -21,7 +20,7 @@ interface FieldProps extends Record<string | number | symbol, unknown> {
21
20
  postLink: string;
22
21
  }
23
22
  export default function inertiaAddHelper(req: ReqType, entity: Entity, fields: Fields, record?: Record<string, string | boolean | number | string[]>, view?: boolean): FieldProps;
24
- export declare function getControlsOptions(fieldConfig: BaseFieldConfig, req: ReqType, type: ControlType, defaultControlName: string): {
23
+ export declare function getControlsOptions(fieldConfig: Field["config"], req: ReqType, type: ControlType, defaultControlName: string): {
25
24
  name: string;
26
25
  config: {
27
26
  el?: HTMLElement;
@@ -1,5 +1,6 @@
1
1
  import inertiaActionsHelper from "./inertiaActionsHelper";
2
2
  import chalk from "chalk";
3
+ import { isObject } from "./JsUtils";
3
4
  export default function inertiaAddHelper(req, entity, fields, record, view = false) {
4
5
  const actionType = 'add';
5
6
  let props = {
@@ -25,6 +26,10 @@ export default function inertiaAddHelper(req, entity, fields, record, view = fal
25
26
  continue;
26
27
  let field = fields[key];
27
28
  let fieldConfig = field.config;
29
+ if (!isObject(fieldConfig))
30
+ throw `Type error: fieldConfig is object`;
31
+ if (!!fieldConfig.visible === false)
32
+ continue;
28
33
  const type = (fieldConfig.type || fieldConfig.type).toLowerCase();
29
34
  //@ts-ignore TODO: fix model validations
30
35
  const isIn = typeof fieldConfig.isIn === 'object' ? fieldConfig.isIn : (field.model && typeof { ...field.model.validations }.isIn === 'object' ? { ...field.model.validations }.isIn : []);
@@ -113,6 +118,8 @@ export default function inertiaAddHelper(req, entity, fields, record, view = fal
113
118
  return props;
114
119
  }
115
120
  export function getControlsOptions(fieldConfig, req, type, defaultControlName) {
121
+ if (!isObject(fieldConfig))
122
+ throw `Type error: fieldConfig is object`;
116
123
  const fieldOptions = fieldConfig?.options;
117
124
  let control = getControl(req, type, fieldOptions?.name, defaultControlName);
118
125
  let editorName = control.getName();
@@ -190,6 +197,8 @@ function setAssociationValues(field, value) {
190
197
  let options = [];
191
198
  let initValue = [];
192
199
  const config = field.config;
200
+ if (!isObject(config))
201
+ throw `Type error: config is object`;
193
202
  const isOptionSelected = (option, value) => {
194
203
  if (Array.isArray(value)) {
195
204
  return value.includes(option);
@@ -198,8 +207,8 @@ function setAssociationValues(field, value) {
198
207
  return (option == value);
199
208
  }
200
209
  };
201
- const getAssociationValue = (value, config) => {
202
- const displayField = config.displayField || 'id';
210
+ const getAssociationValue = (value, field) => {
211
+ const displayField = field.modelConfig?.titleField || 'id';
203
212
  if (value === null)
204
213
  return [];
205
214
  if (Array.isArray(value)) {
@@ -212,13 +221,24 @@ function setAssociationValues(field, value) {
212
221
  return String(value);
213
222
  };
214
223
  for (let opt of config.records) {
224
+ const optAny = opt;
225
+ const displayField = typeof field.modelConfig.titleField !== 'undefined'
226
+ ? field.modelConfig.titleField
227
+ : typeof optAny.title !== 'undefined'
228
+ ? 'title'
229
+ : typeof optAny.name !== 'undefined'
230
+ ? 'name'
231
+ : config.identifierField;
232
+ const label = typeof config.displayModifier === 'function'
233
+ ? config.displayModifier(opt)
234
+ : optAny[displayField];
215
235
  options.push({
216
- label: config.displayModifier && typeof config.displayModifier === 'function'
217
- ? config.displayModifier(opt)
218
- : (config.displayField ? opt[config.displayField] : opt[config.identifierField]),
219
- value: opt[config.identifierField],
236
+ label,
237
+ value: optAny[config.identifierField],
220
238
  });
221
- if (isOptionSelected(opt[config.identifierField], getAssociationValue(value, config))) {
239
+ if (!isObject(config))
240
+ throw `Type error: config is object`;
241
+ if (config.identifierField && isOptionSelected(opt[config.identifierField], getAssociationValue(value, field))) {
222
242
  initValue.push(opt[config.identifierField]);
223
243
  }
224
244
  }
@@ -9,6 +9,8 @@ export default function inertiaFormHelper(req, postLink, formData) {
9
9
  };
10
10
  for (const key of Object.keys(formData)) {
11
11
  let field = formData[key];
12
+ if (!!field.visible === false)
13
+ continue;
12
14
  const type = (field.type || field.type).toLowerCase();
13
15
  const isIn = field.isIn ?? [];
14
16
  let label = field.title ?? '';
@@ -1,3 +1,5 @@
1
+ import { GroupAP } from "models/GroupAP";
2
+ import { UserAP } from "models/UserAP";
1
3
  import { AccessRightsToken, Entity, PropsField } from "../interfaces/types";
2
4
  interface groupedTokens {
3
5
  header: string;
@@ -20,7 +22,7 @@ interface listProps extends Record<string | number | symbol, unknown> {
20
22
  users: PropsField[];
21
23
  groupedTokens: groupedTokens[];
22
24
  }
23
- export declare function inertiaGroupHelper(entity: Entity, req: ReqType, users: ModelsAP["UserAP"][], groupedTokens: {
25
+ export declare function inertiaGroupHelper(entity: Entity, req: ReqType, users: UserAP[], groupedTokens: {
24
26
  [key: string]: AccessRightsToken[];
25
- }, group?: ModelsAP["GroupAP"], view?: boolean): listProps;
27
+ }, group?: GroupAP, view?: boolean): listProps;
26
28
  export {};
@@ -55,7 +55,7 @@ export function inertiaGroupHelper(entity, req, users, groupedTokens, group, vie
55
55
  label: token.name,
56
56
  tooltip: token.description,
57
57
  name: `token-checkbox-${token.id}`,
58
- value: group ? (group.tokens && group.tokens.includes(token.id)) : false,
58
+ value: group ? (group.tokens && group.tokens?.includes(token.id)) : false,
59
59
  type: 'checkbox'
60
60
  });
61
61
  }
@@ -24,22 +24,22 @@ export function inertiaListHelper(entity, req, fields) {
24
24
  searchBtn: req.i18n.__('Search'),
25
25
  resetBtn: req.i18n.__('Reset'),
26
26
  };
27
- if (entity.config.add && req.adminizer.accessRightsHelper.hasPermission(`create-${entity.name}-model`, req.session.UserAP)) {
27
+ if (entity.config.add && req.adminizer.accessRightsHelper.hasPermission(`create-${entity.name}-model`, req.user)) {
28
28
  props.crudActions.createTitle = req.i18n.__('create');
29
29
  }
30
- if (req.adminizer.accessRightsHelper.hasPermission(`update-${entity.name}-model`, req.session.UserAP)) {
30
+ if (req.adminizer.accessRightsHelper.hasPermission(`update-${entity.name}-model`, req.user)) {
31
31
  props.crudActions.editTitle = req.i18n.__('Edit');
32
32
  }
33
- if (req.adminizer.accessRightsHelper.hasPermission(`read-${entity.name}-model`, req.session.UserAP)) {
33
+ if (req.adminizer.accessRightsHelper.hasPermission(`read-${entity.name}-model`, req.user)) {
34
34
  props.crudActions.viewsTitle = req.i18n.__('View');
35
35
  }
36
- if (req.adminizer.accessRightsHelper.hasPermission(`delete-${entity.name}-model`, req.session.UserAP)) {
36
+ if (req.adminizer.accessRightsHelper.hasPermission(`delete-${entity.name}-model`, req.user)) {
37
37
  props.crudActions.deleteTitle = req.i18n.__('Delete');
38
38
  }
39
39
  props.actions = inertiaActionsHelper(actionType, entity, req);
40
40
  if (req.adminizer.menuHelper.hasInlineActions(entity.config, 'list')) {
41
41
  for (const inlineAction of req.adminizer.menuHelper.getInlineActions(entity.config, 'list')) {
42
- if (req.adminizer.accessRightsHelper.hasPermission(inlineAction.accessRightsToken, req.session.UserAP)) {
42
+ if (req.adminizer.accessRightsHelper.hasPermission(inlineAction.accessRightsToken, req.user)) {
43
43
  props.inlineActions.push({
44
44
  icon: inlineAction.icon,
45
45
  id: inlineAction.id,
@@ -3,6 +3,6 @@ export declare class InertiaMenuHelper {
3
3
  private adminizer;
4
4
  constructor(adminizer: Adminizer);
5
5
  getMenuItems(req: ReqType): import("./menuHelper").MenuItem[];
6
- getBrandTitle(): any;
6
+ getBrandTitle(): string;
7
7
  getLogoutUrl(): string;
8
8
  }
@@ -5,7 +5,7 @@ export class InertiaMenuHelper {
5
5
  }
6
6
  getMenuItems(req) {
7
7
  let menu = [];
8
- for (const menuItem of this.adminizer.menuHelper.getMenuItems()) {
8
+ for (const menuItem of this.adminizer.menuHelper.getMenuItems(req.user)) {
9
9
  const menuItemTokens = menuItem.actions ? menuItem.actions.map(item => {
10
10
  return item.accessRightsToken;
11
11
  }).filter(item => {
@@ -13,7 +13,7 @@ export class InertiaMenuHelper {
13
13
  }) : [];
14
14
  if (menuItem.accessRightsToken)
15
15
  menuItemTokens.push(menuItem.accessRightsToken);
16
- if (this.adminizer.accessRightsHelper.enoughPermissions(menuItemTokens, req.session.UserAP)) {
16
+ if (this.adminizer.accessRightsHelper.enoughPermissions(menuItemTokens, req.user)) {
17
17
  menu.push(menuItem);
18
18
  }
19
19
  }
@@ -1,3 +1,5 @@
1
+ import { GroupAP } from "models/GroupAP";
2
+ import { UserAP } from "models/UserAP";
1
3
  import { Entity, PropsField } from "../interfaces/types";
2
4
  interface listProps extends Record<string | number | symbol, unknown> {
3
5
  edit: boolean;
@@ -16,6 +18,10 @@ interface listProps extends Record<string | number | symbol, unknown> {
16
18
  fields: PropsField[];
17
19
  groups: PropsField[];
18
20
  locales: Record<string, string>[];
21
+ userPretend: {
22
+ label: string;
23
+ postLink: string;
24
+ };
19
25
  }
20
- export declare function inertiaUserHelper(entity: Entity, req: ReqType, groups: ModelsAP["GroupAP"][], user?: ModelsAP["UserAP"], view?: boolean): listProps;
26
+ export declare function inertiaUserHelper(entity: Entity, req: ReqType, groups: GroupAP[], user?: UserAP, view?: boolean): listProps;
21
27
  export {};
@@ -6,6 +6,10 @@ export function inertiaUserHelper(entity, req, groups, user, view = false) {
6
6
  title: req.i18n.__('Back'),
7
7
  link: entity.uri
8
8
  },
9
+ userPretend: {
10
+ label: req.i18n.__('Pretend to be a user'),
11
+ postLink: `${req.adminizer.config.routePrefix}/model/userap/login`
12
+ },
9
13
  passwordError: req.i18n.__('Values in "password" and "repeatPassword" fields should be the same'),
10
14
  btnSave: {
11
15
  title: req.i18n.__('Save')
@@ -58,7 +62,7 @@ export function inertiaUserHelper(entity, req, groups, user, view = false) {
58
62
  value: user?.locale ?? ''
59
63
  });
60
64
  }
61
- if (req.session.UserAP.isAdministrator) {
65
+ if (req.user.isAdministrator) {
62
66
  props.fields.push({
63
67
  label: req.i18n.__('Profile expires'),
64
68
  type: 'date',
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * @constructor
5
5
  */
6
+ import { UserAP } from "models/UserAP";
6
7
  import { ActionType, AdminpanelConfig, HrefConfig, ModelConfig } from "../interfaces/adminpanelConfig";
7
8
  export type MenuItem = {
8
9
  link: string;
@@ -15,14 +16,14 @@ export type MenuItem = {
15
16
  entityName?: string;
16
17
  };
17
18
  export declare class MenuHelper {
18
- private static config;
19
+ private config;
19
20
  constructor(config: AdminpanelConfig);
20
21
  /**
21
22
  * Get menu brand title
22
23
  *
23
24
  * @returns {string}
24
25
  */
25
- getBrandTitle(): any;
26
+ getBrandTitle(): string;
26
27
  /**
27
28
  * Check if global actions buttons added to action
28
29
  *
@@ -60,5 +61,5 @@ export declare class MenuHelper {
60
61
  *
61
62
  * @returns {Array}
62
63
  */
63
- getMenuItems(): MenuItem[];
64
+ getMenuItems(user: UserAP): MenuItem[];
64
65
  }
@@ -1,7 +1,8 @@
1
+ import { GroupsAccessRightsHelper } from "./accessRightsHelper";
1
2
  export class MenuHelper {
2
- static config;
3
+ config;
3
4
  constructor(config) {
4
- MenuHelper.config = config;
5
+ this.config = config;
5
6
  }
6
7
  /**
7
8
  * Get menu brand title
@@ -9,14 +10,14 @@ export class MenuHelper {
9
10
  * @returns {string}
10
11
  */
11
12
  getBrandTitle() {
12
- if (!MenuHelper.config.brand || !MenuHelper.config.brand.link) {
13
+ if (!this.config.brand || !this.config.brand.link) {
13
14
  return 'Adminizer';
14
15
  }
15
- if (typeof MenuHelper.config.brand.link === "string") {
16
- return MenuHelper.config.brand.link;
16
+ if (typeof this.config.brand.link === "string") {
17
+ return this.config.brand.link;
17
18
  }
18
- if (typeof MenuHelper.config.brand.link === "object" && typeof MenuHelper.config.brand.link.title === "string") {
19
- return MenuHelper.config.brand.link.title;
19
+ if (typeof this.config.brand.link === "object" && typeof this.config.brand.link.title === "string") {
20
+ return this.config.brand.link.title;
20
21
  }
21
22
  return 'Adminizer';
22
23
  }
@@ -98,10 +99,10 @@ export class MenuHelper {
98
99
  *
99
100
  * @returns {Array}
100
101
  */
101
- getMenuItems() {
102
+ getMenuItems(user) {
102
103
  let menus = [];
103
- if (MenuHelper.config.navbar.additionalLinks && MenuHelper.config.navbar.additionalLinks.length > 0) {
104
- MenuHelper.config.navbar.additionalLinks.forEach(function (additionalLink) {
104
+ if (this.config.navbar.additionalLinks && this.config.navbar.additionalLinks.length > 0) {
105
+ this.config.navbar.additionalLinks.forEach(function (additionalLink) {
105
106
  if (!additionalLink.link || !additionalLink.title || additionalLink.disabled) {
106
107
  return;
107
108
  }
@@ -116,13 +117,19 @@ export class MenuHelper {
116
117
  });
117
118
  });
118
119
  }
119
- if (MenuHelper.config.models) {
120
- Object.entries(MenuHelper.config.models).forEach(function ([key, val]) {
121
- if (!val.hide) {
120
+ if (this.config.models) {
121
+ const _this = this;
122
+ Object.entries(this.config.models).forEach(function ([key, val]) {
123
+ const hide = typeof val.navbar?.visible === 'boolean'
124
+ ? !val.navbar.visible
125
+ : val.navbar?.groupsAccessRights
126
+ ? !GroupsAccessRightsHelper.hasAccess(user, val.navbar.groupsAccessRights)
127
+ : false;
128
+ if (!hide) {
122
129
  if (val.tools && val.tools.length > 0 && val.tools[0].id !== "overview") {
123
130
  val.tools.unshift({
124
131
  id: "overview",
125
- link: MenuHelper.config.routePrefix + '/model/' + key,
132
+ link: _this.config.routePrefix + '/model/' + key,
126
133
  title: 'Overview',
127
134
  type: 'self',
128
135
  icon: "list",
@@ -130,7 +137,7 @@ export class MenuHelper {
130
137
  });
131
138
  }
132
139
  menus.push({
133
- link: MenuHelper.config.routePrefix + '/model/' + key,
140
+ link: _this.config.routePrefix + '/model/' + key,
134
141
  title: val.title || key,
135
142
  icon: val.icon || null,
136
143
  actions: val.tools || null,
package/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  export * from "./helpers/configHelper";
2
2
  export * from "./helpers/accessRightsHelper";
3
- export * from "./lib/installStepper/installStepper";
4
- export * from "./lib/widgets/widgetHandler";
5
- export * from "./lib/catalog/CatalogHandler";
3
+ export * from "./lib/v4/widgets/widgetHandler";
4
+ export * from "./lib/v4/catalog/CatalogHandler";
6
5
  export * from "./lib/media-manager/MediaManagerHandler";
7
6
  export * from "./interfaces/adminpanelConfig";
8
7
  export * from "./lib/v4/model/AbstractModel";
@@ -10,3 +9,6 @@ export * from "./lib/v4/model/adapter/waterline";
10
9
  export * from "./lib/v4/model/adapter/typeorm";
11
10
  export * from "./lib/v4/model/adapter/sequelize";
12
11
  export * from "./lib/Adminizer";
12
+ export * from "./models/GroupAP";
13
+ export * from "./models/UserAP";
14
+ export * from "./models/NavigationAP";
package/index.js CHANGED
@@ -1,8 +1,7 @@
1
1
  export * from "./helpers/configHelper";
2
2
  export * from "./helpers/accessRightsHelper";
3
- export * from "./lib/installStepper/installStepper";
4
- export * from "./lib/widgets/widgetHandler";
5
- export * from "./lib/catalog/CatalogHandler";
3
+ export * from "./lib/v4/widgets/widgetHandler";
4
+ export * from "./lib/v4/catalog/CatalogHandler";
6
5
  export * from "./lib/media-manager/MediaManagerHandler";
7
6
  export * from "./interfaces/adminpanelConfig";
8
7
  export * from "./lib/v4/model/AbstractModel";
@@ -10,3 +9,9 @@ export * from "./lib/v4/model/adapter/waterline";
10
9
  export * from "./lib/v4/model/adapter/typeorm";
11
10
  export * from "./lib/v4/model/adapter/sequelize";
12
11
  export * from "./lib/Adminizer";
12
+ export * from "./models/GroupAP";
13
+ export * from "./models/UserAP";
14
+ // export * from "./models/MediaManagerAP"
15
+ // export * from "./models/MediaManagerAssociationsAP"
16
+ // export * from "./models/MediaManagerMetaAP"
17
+ export * from "./models/NavigationAP";
@@ -1,6 +1,8 @@
1
1
  import { MaterialIcon } from "./MaaterialIcons";
2
2
  import { EditorOptions } from "@toast-ui/editor/types/editor";
3
3
  import { GridSettings as HandsontableSettings } from "handsontable/settings";
4
+ import { GroupAP } from "models/GroupAP";
5
+ import { UserAP } from "models/UserAP";
4
6
  export type AdminpanelIcon = MaterialIcon;
5
7
  export type FieldsTypes = "string" | "password" | "date" | "datetime" | "time" | "integer" | "number" | "float" | "color" | "email" | "month" | "week" | "range" | "boolean" | "binary" | "text" | "longtext" | "mediumtext" | "ckeditor" | "wysiwyg" | "texteditor" | "word" | 'tui' | 'tuieditor' | 'toast-ui' | "jsoneditor" | "json" | "array" | "object" | "ace" | "code" | "html" | "xml" | "aceeditor" | "menu" | "schedule" | "worktime" | "association" | "association-many" | "select" | "select-many" | "table" | "geojson" | "mediamanager" |
6
8
  /**
@@ -37,7 +39,7 @@ export interface AdminpanelConfig {
37
39
  * reference upload contoroller ~50 line
38
40
  * */
39
41
  models: {
40
- [key: string]: ModelConfig | boolean;
42
+ [key: string]: ModelConfig;
41
43
  };
42
44
  /**
43
45
  * For custom adminpanel sections, displays inside header
@@ -121,23 +123,6 @@ export interface AdminpanelConfig {
121
123
  * */
122
124
  set?: SetFunction;
123
125
  };
124
- /**
125
- * Wizards
126
- * */
127
- installStepper?: {
128
- path: string;
129
- data: {
130
- [key: string]: FieldsModels;
131
- };
132
- /**
133
- * Custom getter
134
- * */
135
- get?: GetFunction;
136
- /**
137
- * Custom setter
138
- * */
139
- set?: SetFunction;
140
- };
141
126
  /**
142
127
  * Prime administrator login credentials
143
128
  * */
@@ -178,12 +163,6 @@ export interface AdminpanelConfig {
178
163
  * Navigation
179
164
  */
180
165
  navigation?: NavigationConfig;
181
- /**
182
- * Path to modules views
183
- */
184
- modulesViewsPath?: string;
185
- /** @deprecated (module manager can be used it somehow) */
186
- templateRootPath?: string;
187
166
  mediamanager?: MediaManagerConfig;
188
167
  /** System settings */
189
168
  system?: {
@@ -199,9 +178,19 @@ export interface ModelConfig {
199
178
  * */
200
179
  model: string;
201
180
  /**
202
- * Hide entity in left navbar
181
+ * If the field is not definitely, then it will appear in Navbar
203
182
  * */
204
- hide?: boolean;
183
+ navbar?: {
184
+ /**
185
+ * @default true
186
+ */
187
+ visible?: boolean;
188
+ /**
189
+ * User groups who will see the menu item
190
+ * For which it will be shown if not established will be shown to all groups who have the rights to read
191
+ */
192
+ groupsAccessRights?: string[];
193
+ };
205
194
  /**
206
195
  * Entity fields configuration
207
196
  * */
@@ -228,7 +217,7 @@ export interface ModelConfig {
228
217
  filter?: {
229
218
  [key: string]: {
230
219
  name: string;
231
- criteria: any;
220
+ criteria: Record<string, any>;
232
221
  };
233
222
  };
234
223
  } | boolean;
@@ -256,6 +245,11 @@ export interface ModelConfig {
256
245
  * Entity icon
257
246
  * */
258
247
  icon?: MaterialIcon;
248
+ /**
249
+ * The field that will be shown for communication
250
+ * @default `title` or `name`
251
+ */
252
+ titleField?: string;
259
253
  /**
260
254
  * Force set primary key
261
255
  * */
@@ -264,12 +258,12 @@ export interface ModelConfig {
264
258
  * May be association or association-many to UserAP or GroupAP */
265
259
  userAccessRelation?: {
266
260
  field: string;
267
- via: string;
261
+ via?: string;
268
262
  } | string;
269
263
  userAccessRelationCallback?: (userWithGroups: UserWithGroups, record: any) => boolean;
270
264
  }
271
- type UserWithGroups = ModelsAP["UserAP"] & {
272
- groups: ModelsAP["GroupAP"][];
265
+ type UserWithGroups = UserAP & {
266
+ groups: GroupAP[];
273
267
  };
274
268
  export interface FieldsForms {
275
269
  [key: string]: FormFieldConfig;
@@ -306,6 +300,7 @@ export interface BaseFieldConfig {
306
300
  identifierField?: string;
307
301
  /**
308
302
  * Label for associations
303
+ * @deprecated use model labelField prop
309
304
  * */
310
305
  displayField?: string;
311
306
  /**
@@ -316,6 +311,8 @@ export interface BaseFieldConfig {
316
311
  disabled?: boolean;
317
312
  /** Show as required element HTML */
318
313
  required?: boolean;
314
+ /** show or hode element, default `true` */
315
+ visible?: boolean;
319
316
  }
320
317
  export interface TuiEditorFieldConfig extends BaseFieldConfig {
321
318
  type: 'tui' | 'tuieditor' | 'toast-ui';
@@ -403,7 +400,7 @@ export interface HrefConfig {
403
400
  /**
404
401
  * Only for view, controller still uses his own access rights token
405
402
  * */
406
- accessRightsToken?: string;
403
+ accessRightsToken?: string | undefined;
407
404
  /**
408
405
  * For menu items only
409
406
  * */
@@ -2,17 +2,12 @@ import { Adminizer } from "../lib/Adminizer";
2
2
  import { NextFunction, Request, Response } from "express";
3
3
  import multer from "multer";
4
4
  import { I18n } from "../lib/v4/I18n";
5
- import { Inertia } from "../lib/inertia/inertiaAdapter";
6
- import { Flash } from "../lib/inertia/flash";
5
+ import { Inertia } from "../lib/v4/inertia/inertiaAdapter";
6
+ import { Flash } from "../lib/v4/inertia/flash";
7
+ import { UserAP } from "models/UserAP";
7
8
  declare global {
9
+ /** @deprecated use import from TS model decalration */
8
10
  type ModelsAP = {
9
- GroupAP: {
10
- id?: number;
11
- name: string;
12
- description?: string;
13
- tokens?: string[];
14
- users?: ModelsAP["UserAP"][];
15
- };
16
11
  MediaManagerAP: {
17
12
  id?: string;
18
13
  parent?: ModelsAP["MediaManagerAP"];
@@ -48,36 +43,20 @@ declare global {
48
43
  label: string;
49
44
  tree: any;
50
45
  };
51
- UserAP: {
52
- id?: number;
53
- login?: string;
54
- fullName?: string;
55
- email?: string;
56
- passwordHashed?: string;
57
- password?: string;
58
- timezone?: string;
59
- expires?: string;
60
- locale?: string;
61
- isDeleted?: boolean;
62
- isActive?: boolean;
63
- isAdministrator?: boolean;
64
- groups?: ModelsAP["GroupAP"][];
65
- widgets?: any;
66
- isConfirmed?: boolean;
67
- };
68
46
  };
69
47
  type reqSession = {
70
48
  flashMessages: Record<string, string[]>;
71
49
  xInertiaCurrentComponent: string | undefined;
72
- UserAP: ModelsAP["UserAP"];
50
+ UserAP: UserAP;
73
51
  messages: {
74
52
  adminError: string[];
75
53
  adminSuccess: string[];
76
54
  };
77
- adminPretender?: ModelsAP["UserAP"];
55
+ userPretended?: UserAP;
78
56
  };
79
57
  type FlashMessages = 'info' | 'error' | 'success' | string;
80
58
  type ReqType = Request & {
59
+ user: UserAP;
81
60
  Inertia: Inertia;
82
61
  flash: Flash<FlashMessages>;
83
62
  session: reqSession;
@@ -96,6 +75,9 @@ declare global {
96
75
  i18n: I18n;
97
76
  };
98
77
  type ResType = Response & {
78
+ /**
79
+ * @deprecated // TODO delete after finish catalog
80
+ */
99
81
  viewAdmin(specifiedPath: string, locals?: any, cb_view?: Function): void;
100
82
  };
101
83
  type MiddlewareType = (req: ReqType, res: ResType, next: NextFunction) => void;