adminizer 4.7.0-build.224 → 5.0.0-build.1
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.
- package/Readme.md +2 -1
- package/assets/add-De0wyF0A.js +1 -0
- package/assets/add-group-CMWybgIR.js +1 -0
- package/assets/add-user-BxP23daH.js +1 -0
- package/assets/app-CtWuWD5N.css +1 -0
- package/assets/app-layout-GYMU2HO1.js +1 -0
- package/assets/app.js +45 -50
- package/assets/catalog-tImW1BnS.js +6 -0
- package/assets/controls/chunks/_commonjsHelpers-C6fGbg64.js +6 -0
- package/assets/controls/chunks/index-CjiZ2FIa.js +93 -0
- package/assets/controls/chunks/jsx-runtime-jIxVPx5o.js +31 -0
- package/assets/controls/chunks/use-appearance-CFLOwiSX.js +38 -0
- package/assets/controls/chunks/use-window-size-BXgBKW65.js +19 -0
- package/assets/controls/chunks/vanilla-picker-Dg97NL4h.js +529 -0
- package/assets/controls/ckeditor.es.js +83683 -0
- package/assets/controls/handsontable.css +1 -0
- package/assets/controls/handsontable.es.js +70585 -0
- package/assets/controls/jsoneditor.css +1 -0
- package/assets/controls/jsoneditor.es.js +42082 -0
- package/assets/controls/leaflet.css +1 -0
- package/assets/controls/leaflet.es.js +10299 -0
- package/assets/controls/monaco.es.js +618 -0
- package/assets/controls/toast-ui.css +1 -0
- package/assets/controls/toast-ui.es.js +41797 -0
- package/assets/dashboard-CQ4atH3N.js +3 -0
- package/assets/debounce-BMmXVQ06.js +1 -0
- package/assets/history-BileQPEi.js +1 -0
- package/assets/init-user-8aUohVDq.js +1 -0
- package/assets/list-Pz_5mfSq.js +4 -0
- package/assets/login-CO4laf6m.js +1 -0
- package/assets/manifest.json +66 -602
- package/assets/media-manager-BDbpSSjH.js +6 -0
- package/assets/media-manager-BZPjl98I.css +1 -0
- package/assets/module-CQiOdgZN.js +1 -0
- package/assets/notification-BIyv1smE.js +20 -0
- package/assets/register-DBYIMXGQ.js +1 -0
- package/assets/ru-rYKdQbWF.js +1 -0
- package/assets/use-appearance-_EbbjHTh.js +1 -0
- package/assets/user-filters-list-Aq8CvCeh.js +1 -0
- package/assets/welcome-DxhWYzUL.js +1 -0
- package/controllers/add.d.ts +1 -1
- package/controllers/addGroup.js +3 -3
- package/controllers/addUser.js +3 -3
- package/controllers/catalog/Catalog.d.ts +1 -1
- package/controllers/catalog/Catalog.js +2 -1
- package/controllers/catalog/FrontendCatalogAdapter.d.ts +2 -12
- package/controllers/catalog/FrontendCatalogAdapter.js +3 -16
- package/controllers/catalog/FrontentCatalogAdapter.d.ts +2 -12
- package/controllers/catalog/FrontentCatalogAdapter.js +0 -16
- package/controllers/edit.js +6 -11
- package/controllers/editGroup.d.ts +1 -1
- package/controllers/editGroup.js +3 -3
- package/controllers/editUser.d.ts +1 -1
- package/controllers/editUser.js +3 -3
- package/controllers/feed.js +1 -1
- package/controllers/filter-fields/columns.js +1 -1
- package/controllers/filter-fields/getAllUserFilters.js +2 -2
- package/controllers/filter-fields/groups.js +2 -2
- package/controllers/filter-fields/savedFilters.js +1 -1
- package/controllers/history-actions/HistoryController.js +1 -1
- package/controllers/initUser.js +2 -2
- package/controllers/list.d.ts +1 -1
- package/controllers/login.d.ts +1 -1
- package/controllers/login.js +3 -3
- package/controllers/media-manager/ThumbController.js +2 -2
- package/controllers/media-manager/mediaManagerApi.js +13 -15
- package/controllers/register.d.ts +1 -1
- package/controllers/register.js +5 -5
- package/controllers/remove.d.ts +1 -1
- package/controllers/userApiKey.js +2 -2
- package/controllers/view.d.ts +1 -1
- package/controllers/view.js +5 -5
- package/controllers/widgets/Action.js +5 -2
- package/controllers/widgets/filterInfo.js +1 -1
- package/files/favicon.png +0 -0
- package/helpers/accessRightsHelper.d.ts +6 -4
- package/helpers/accessRightsHelper.js +13 -0
- package/helpers/diffHelpers.js +1 -1
- package/helpers/fieldsHelper.d.ts +1 -1
- package/helpers/fieldsHelper.js +8 -4
- package/helpers/filterDatetimeHelper.d.ts +1 -1
- package/helpers/inertiaAddHelper.d.ts +6 -5
- package/helpers/inertiaAddHelper.js +45 -37
- package/helpers/inertiaAutHelper.js +5 -5
- package/helpers/inertiaGroupHelper.d.ts +4 -4
- package/helpers/inertiaMenuHelper.js +1 -1
- package/helpers/inertiaUserHelper.d.ts +3 -3
- package/helpers/inertiaUserHelper.js +1 -1
- package/helpers/menuHelper.d.ts +2 -2
- package/index.d.ts +19 -6
- package/index.js +19 -6
- package/interfaces/adminpanelConfig.d.ts +10 -33
- package/interfaces/global.d.ts +10 -15
- package/interfaces/listQueryBuilder.d.ts +1 -1
- package/lib/Adminizer.d.ts +25 -2
- package/lib/Adminizer.js +124 -50
- package/lib/DataAccessor.d.ts +9 -5
- package/lib/DataAccessor.js +89 -42
- package/lib/access-rights/AccessRightsHandler.d.ts +17 -0
- package/lib/access-rights/AccessRightsHandler.js +63 -0
- package/lib/ai-assistant/AbstractAiModelService.d.ts +5 -8
- package/lib/ai-assistant/AbstractAiModelService.js +3 -14
- package/lib/ai-assistant/AiAssistantHandler.d.ts +2 -2
- package/lib/app-manager/AdminizerApp.d.ts +228 -0
- package/lib/app-manager/AdminizerApp.js +17 -0
- package/lib/app-manager/AppManager.d.ts +18 -0
- package/lib/app-manager/AppManager.js +537 -0
- package/lib/app-manager/AssetHandler.d.ts +17 -0
- package/lib/app-manager/AssetHandler.js +67 -0
- package/lib/app-manager/ConfigLayerHandler.d.ts +18 -0
- package/lib/app-manager/ConfigLayerHandler.js +119 -0
- package/lib/app-manager/ControllerHandler.d.ts +25 -0
- package/lib/app-manager/ControllerHandler.js +140 -0
- package/lib/catalog/AbstractCatalog.d.ts +28 -19
- package/lib/catalog/AbstractCatalog.js +41 -10
- package/lib/catalog/CatalogHandler.d.ts +13 -0
- package/lib/catalog/CatalogHandler.js +48 -2
- package/lib/catalog/CatalogTemplateComponentHandler.d.ts +23 -0
- package/lib/catalog/CatalogTemplateComponentHandler.js +59 -0
- package/lib/controls/Control.d.ts +17 -0
- package/lib/controls/Control.js +1 -0
- package/lib/controls/ControlsHandler.d.ts +5 -6
- package/lib/controls/ControlsHandler.js +0 -13
- package/lib/controls/codeEditor/MonacoEditor.d.ts +3 -4
- package/lib/controls/codeEditor/MonacoEditor.js +13 -8
- package/lib/controls/geojsoneditor/GeoEditor.d.ts +3 -4
- package/lib/controls/geojsoneditor/GeoEditor.js +14 -9
- package/lib/controls/jsoneditor/JsonEditor.d.ts +5 -6
- package/lib/controls/jsoneditor/JsonEditor.js +14 -13
- package/lib/controls/markdown/ToastUiEditor.d.ts +5 -6
- package/lib/controls/markdown/ToastUiEditor.js +14 -13
- package/lib/controls/table/Handsontable.d.ts +5 -6
- package/lib/controls/table/Handsontable.js +14 -13
- package/lib/controls/wysiwyg/CKeditor.d.ts +5 -6
- package/lib/controls/wysiwyg/CKeditor.js +14 -13
- package/lib/filters/ConditionValidator.d.ts +1 -1
- package/lib/filters/FilterService.d.ts +18 -18
- package/lib/filters/FilterService.js +11 -11
- package/lib/history-actions/AbstractHistoryAdapter.d.ts +14 -14
- package/lib/history-actions/AbstractHistoryAdapter.js +5 -6
- package/lib/history-actions/DefaultHistoryAdapter.d.ts +7 -7
- package/lib/history-actions/DefaultHistoryAdapter.js +2 -2
- package/lib/list-query-builder/ListQueryBuilder.d.ts +1 -1
- package/lib/media-manager/AbstractMediaManager.d.ts +14 -3
- package/lib/media-manager/AbstractMediaManager.js +16 -5
- package/lib/media-manager/MediaManagerHandler.d.ts +3 -0
- package/lib/media-manager/MediaManagerHandler.js +30 -5
- package/lib/media-manager/Thumb.js +7 -13
- package/lib/media-manager/helpers/MediaManagerHelper.d.ts +6 -4
- package/lib/media-manager/helpers/MediaManagerHelper.js +18 -18
- package/lib/model/AbstractModel.d.ts +9 -5
- package/lib/model/AbstractModel.js +9 -13
- package/lib/model/InternalModelAccessFactory.js +9 -10
- package/lib/model/ModelHandler.d.ts +45 -7
- package/lib/model/ModelHandler.js +168 -11
- package/lib/model/adapter/sequelize.d.ts +2 -4
- package/lib/model/adapter/sequelize.js +16 -193
- package/lib/model/adapter/typeorm.d.ts +2 -4
- package/lib/model/adapter/typeorm.js +2 -35
- package/lib/notifications/AbstractNotificationService.d.ts +9 -9
- package/lib/notifications/AbstractNotificationService.js +8 -8
- package/lib/notifications/GeneralNotificationService.js +1 -1
- package/lib/notifications/SystemNotificationService.js +1 -1
- package/lib/ui-i18n/uiTranslationKeys.d.ts +1 -1
- package/lib/ui-i18n/uiTranslationKeys.js +1 -0
- package/lib/widgets/abstractCustom.d.ts +5 -2
- package/lib/widgets/abstractCustom.js +4 -0
- package/lib/widgets/widgetHandler.d.ts +5 -2
- package/lib/widgets/widgetHandler.js +60 -14
- package/models/{FilterAP.d.ts → Filter.d.ts} +4 -70
- package/models/Filter.js +1 -0
- package/models/FilterColumn.d.ts +10 -0
- package/models/FilterColumn.js +1 -0
- package/models/Group.d.ts +8 -0
- package/models/Group.js +1 -0
- package/models/HistoryActions.d.ts +14 -0
- package/models/HistoryActions.js +1 -0
- package/models/MediaManagerAP.d.ts +2 -54
- package/models/MediaManagerAP.js +1 -51
- package/models/MediaManagerAssociationsAP.d.ts +1 -35
- package/models/MediaManagerAssociationsAP.js +1 -33
- package/models/MediaManagerMetaAP.d.ts +2 -30
- package/models/MediaManagerMetaAP.js +1 -27
- package/models/Notification.d.ts +13 -0
- package/models/Notification.js +1 -0
- package/models/User.d.ts +23 -0
- package/models/User.js +1 -0
- package/models/UserNotification.d.ts +7 -0
- package/models/UserNotification.js +1 -0
- package/package.json +25 -30
- package/services/FeedService.d.ts +5 -5
- package/services/FeedService.js +1 -1
- package/system/Router.js +2 -10
- package/system/bindAccessRights.js +1 -1
- package/system/bindAuthorization.js +2 -2
- package/system/bindControls.js +7 -6
- package/system/bindDashboardWidgets.js +3 -2
- package/system/bindDev.js +1 -1
- package/system/bindHistory.d.ts +1 -1
- package/system/bindHistory.js +1 -1
- package/system/bindInertia.js +0 -6
- package/system/bindMediaManager.js +4 -17
- package/system/bindNotifications.d.ts +1 -1
- package/system/bindNotifications.js +1 -1
- package/system/bindReqFunctions.d.ts +1 -0
- package/system/bindReqFunctions.js +20 -3
- package/system/buildInternalModelAccess.js +2 -15
- package/system/defaults.js +5 -10
- package/system/systemModelContracts.d.ts +22 -0
- package/system/systemModelContracts.js +155 -0
- package/system/validateSystemModels.d.ts +2 -0
- package/system/validateSystemModels.js +101 -0
- package/translations/ar.json +2 -1
- package/translations/cn.json +2 -1
- package/translations/de.json +2 -1
- package/translations/en.json +1 -0
- package/translations/es.json +2 -1
- package/translations/fr.json +2 -1
- package/translations/hi.json +2 -1
- package/translations/jp.json +2 -1
- package/translations/ko.json +2 -1
- package/translations/pt.json +2 -1
- package/translations/ru.json +2 -1
- package/translations/ua.json +2 -1
- package/translations/uz.json +2 -1
- package/translations/vi.json +2 -1
- package/assets/RelationDialogStack-DhThUMep.js +0 -20
- package/assets/add-group-L8lMigab.js +0 -1
- package/assets/add-group-form-o7F6t6qW.js +0 -1
- package/assets/add-user-BE4-TNJw.js +0 -1
- package/assets/add-user-form-BP_8TjxN.js +0 -1
- package/assets/add-w398ZkhF.js +0 -1
- package/assets/app-C7J5ccrI.css +0 -1
- package/assets/app-layout-Bg455MIY.js +0 -1
- package/assets/app-shell-BT2kF0We.js +0 -1
- package/assets/app-sidebar-CZfPUXck.js +0 -1
- package/assets/app-sidebar-header-UVcKhNm6.js +0 -1
- package/assets/breadcrumbs-CrqIBT84.js +0 -1
- package/assets/catalog-btkCCwiv.js +0 -6
- package/assets/dashboard-Bvasc1cr.js +0 -3
- package/assets/date-picker-kxQWOxHk.js +0 -1
- package/assets/del-modal-C39LR5aQ.js +0 -1
- package/assets/dynamic-controls-DyPP5sTC.js +0 -1
- package/assets/geo-json-CGNQFl6J.js +0 -1
- package/assets/handsontable-Dv59QFH5.js +0 -336
- package/assets/history-DwKR8MPu.js +0 -1
- package/assets/home-BrtAkCRj.js +0 -2
- package/assets/icon-DpUVVHmK.js +0 -1
- package/assets/init-user-8PiKR1zX.js +0 -1
- package/assets/input-error-Cbt-Y3Fj.js +0 -1
- package/assets/jsoneditor-CiPXPMho.js +0 -3869
- package/assets/list-DGsL_qii.js +0 -4
- package/assets/login-Br_FcBU_.js +0 -1
- package/assets/material-icon-DOkM71fv.js +0 -1
- package/assets/module-EgfgIEhF.js +0 -1
- package/assets/monaco-ompgKQ3_.js +0 -11
- package/assets/nav-footer-DzLwfBAE.js +0 -1
- package/assets/nav-main-CSEbjYgs.js +0 -1
- package/assets/nav-user-DJ0hfhfH.js +0 -1
- package/assets/notification-B19ZLro7.js +0 -20
- package/assets/pagination-render-8GvJxq55.js +0 -1
- package/assets/register-CZzIeT2G.js +0 -1
- package/assets/ru-1NdRIQNV.js +0 -1
- package/assets/theme-switcher-CBbEj1u-.js +0 -1
- package/assets/toast-editor-DwVqd1rz.js +0 -668
- package/assets/user-filters-list-7Im79QyS.js +0 -1
- package/assets/user-info-YiU17Mmy.js +0 -1
- package/assets/user-menu-content-gdpNF5-8.js +0 -1
- package/assets/vanilla-picker-B3LgXoKV.js +0 -2
- package/assets/vendor-l0sNRNKZ.js +0 -1
- package/assets/welcome-nT0eFWHb.js +0 -1
- package/controllers/navigation/edit.d.ts +0 -1
- package/controllers/navigation/edit.js +0 -8
- package/lib/ai-assistant/DummyAiModelService.d.ts +0 -8
- package/lib/ai-assistant/DummyAiModelService.js +0 -14
- package/lib/ai-assistant/OpenAiModelService.d.ts +0 -24
- package/lib/ai-assistant/OpenAiModelService.js +0 -184
- package/lib/catalog/Navigation.d.ts +0 -49
- package/lib/catalog/Navigation.js +0 -492
- package/lib/controls/AbstractControls.d.ts +0 -30
- package/lib/controls/AbstractControls.js +0 -14
- package/lib/media-manager/DefaultMediaManager.d.ts +0 -20
- package/lib/media-manager/DefaultMediaManager.js +0 -127
- package/lib/media-manager/Items.d.ts +0 -50
- package/lib/media-manager/Items.js +0 -296
- package/models/FilterAP.js +0 -68
- package/models/FilterColumnAP.d.ts +0 -32
- package/models/FilterColumnAP.js +0 -21
- package/models/GroupAP.d.ts +0 -31
- package/models/GroupAP.js +0 -22
- package/models/HistoryActionsAP.d.ts +0 -56
- package/models/HistoryActionsAP.js +0 -42
- package/models/NavigationAP.d.ts +0 -22
- package/models/NavigationAP.js +0 -16
- package/models/NotificationAP.d.ts +0 -44
- package/models/NotificationAP.js +0 -30
- package/models/UserAP.d.ts +0 -81
- package/models/UserAP.js +0 -57
- package/models/UserNotificationAP.d.ts +0 -26
- package/models/UserNotificationAP.js +0 -18
- package/system/bindAiAssistant.d.ts +0 -2
- package/system/bindAiAssistant.js +0 -30
- package/system/bindModels.d.ts +0 -2
- package/system/bindModels.js +0 -48
- package/system/bindNavigation.d.ts +0 -2
- package/system/bindNavigation.js +0 -38
- /package/assets/{RelationDialogStack-B00Ot5qS.css → controls/ckeditor.css} +0 -0
|
@@ -1,14 +1,15 @@
|
|
|
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 {
|
|
5
|
-
import {
|
|
4
|
+
import { Group } from "../models/Group";
|
|
5
|
+
import { User } from "../models/User";
|
|
6
6
|
import { InternalModelAccessMap } from "./internalModelAccess";
|
|
7
7
|
/**
|
|
8
8
|
* Controller function type - async function that handles requests and returns a response
|
|
9
9
|
*/
|
|
10
10
|
export type ControllerFunction = (req: ReqType, res: ResType) => Promise<any>;
|
|
11
11
|
export type AdminpanelIcon = MaterialIcon;
|
|
12
|
+
export type NonEmptyArray<T> = [T, ...T[]];
|
|
12
13
|
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" | "single-file" |
|
|
13
14
|
/**
|
|
14
15
|
* it will be needed only for polygon data
|
|
@@ -58,7 +59,7 @@ export interface AdminpanelConfig {
|
|
|
58
59
|
/**
|
|
59
60
|
* Optional additional link at the bottom of the login page
|
|
60
61
|
* Example:
|
|
61
|
-
* addishinalLoginPage: { link: '/model/
|
|
62
|
+
* addishinalLoginPage: { link: '/model/User/register', textKey: 'Additional login page' }
|
|
62
63
|
* link can be relative to routePrefix (e.g. 'model/help' or '/model/help') or absolute (https://...)
|
|
63
64
|
*/
|
|
64
65
|
addishinalLoginPage?: {
|
|
@@ -98,13 +99,13 @@ export interface AdminpanelConfig {
|
|
|
98
99
|
* Optional callback to filter or transform all navbar links after models have been processed.
|
|
99
100
|
* Receives all links (static + model-generated) and the current user; returns the final array.
|
|
100
101
|
*/
|
|
101
|
-
handleAdditionalLinks?: (user:
|
|
102
|
+
handleAdditionalLinks?: (user: User, allLinks: HrefConfig[]) => HrefConfig[];
|
|
102
103
|
/**
|
|
103
104
|
* Per-section handlers, applied after all links (static + model-generated) are collected.
|
|
104
105
|
* Each key is a section name; the handler receives links belonging to that section.
|
|
105
106
|
*/
|
|
106
107
|
sectionHandlers?: {
|
|
107
|
-
[section: string]: (user:
|
|
108
|
+
[section: string]: (user: User, links: HrefConfig[]) => HrefConfig[];
|
|
108
109
|
};
|
|
109
110
|
};
|
|
110
111
|
/**
|
|
@@ -198,10 +199,6 @@ export interface AdminpanelConfig {
|
|
|
198
199
|
* System field for store absolute root path adminpanel hookfolder
|
|
199
200
|
*/
|
|
200
201
|
rootPath?: string;
|
|
201
|
-
/**
|
|
202
|
-
* Navigation
|
|
203
|
-
*/
|
|
204
|
-
navigation?: NavigationConfig;
|
|
205
202
|
mediamanager?: MediaManagerConfig;
|
|
206
203
|
/** System settings */
|
|
207
204
|
system?: {
|
|
@@ -395,15 +392,15 @@ export interface ModelConfig {
|
|
|
395
392
|
* */
|
|
396
393
|
identifierField?: string;
|
|
397
394
|
/** In this field we can set model field, for which we want to check user access right.
|
|
398
|
-
* May be association or association-many to
|
|
395
|
+
* May be association or association-many to User or Group */
|
|
399
396
|
userAccessRelation?: {
|
|
400
397
|
field: string;
|
|
401
398
|
via?: string;
|
|
402
399
|
} | string;
|
|
403
400
|
userAccessRelationCallback?: (userWithGroups: UserWithGroups, record: any) => boolean;
|
|
404
401
|
}
|
|
405
|
-
type UserWithGroups =
|
|
406
|
-
groups:
|
|
402
|
+
type UserWithGroups = User & {
|
|
403
|
+
groups: Group[];
|
|
407
404
|
};
|
|
408
405
|
export type ModelFieldConfig = (BaseFieldConfig | TuiEditorFieldConfig) & {
|
|
409
406
|
groupsAccessRights?: string[];
|
|
@@ -491,7 +488,7 @@ export interface TuiEditorFieldConfig extends BaseFieldConfig {
|
|
|
491
488
|
export interface MediaManagerOptionsField {
|
|
492
489
|
id: 'default' | string;
|
|
493
490
|
group: string;
|
|
494
|
-
accept: string
|
|
491
|
+
accept: NonEmptyArray<string>;
|
|
495
492
|
initTab?: 'tile-image' | 'table-video' | 'table-text' | 'table-application' | 'table-all' | 'tile-all';
|
|
496
493
|
config?: Record<string, any>;
|
|
497
494
|
onlyView?: boolean;
|
|
@@ -586,26 +583,6 @@ export interface HrefConfig {
|
|
|
586
583
|
*/
|
|
587
584
|
section?: string;
|
|
588
585
|
}
|
|
589
|
-
export interface NavigationItemTypeConfig {
|
|
590
|
-
model: string;
|
|
591
|
-
title: string;
|
|
592
|
-
/**
|
|
593
|
-
* /page/${data.record.slug}
|
|
594
|
-
*/
|
|
595
|
-
urlPath: string | ((v: any) => string);
|
|
596
|
-
}
|
|
597
|
-
export interface NavigationConfig {
|
|
598
|
-
model?: string;
|
|
599
|
-
sections: string[];
|
|
600
|
-
groupField: {
|
|
601
|
-
name: string;
|
|
602
|
-
required: boolean;
|
|
603
|
-
label: string;
|
|
604
|
-
}[];
|
|
605
|
-
allowContentInGroup?: boolean;
|
|
606
|
-
items: NavigationItemTypeConfig[];
|
|
607
|
-
movingGroupsRootOnly?: boolean;
|
|
608
|
-
}
|
|
609
586
|
export interface MediaManagerConfig {
|
|
610
587
|
fileStoragePath: string;
|
|
611
588
|
allowMIME?: string[];
|
package/interfaces/global.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ import multer from "multer";
|
|
|
4
4
|
import { I18n } from "../lib/I18n";
|
|
5
5
|
import { Inertia } from "../lib/inertia/inertiaAdapter";
|
|
6
6
|
import { Flash } from "../lib/inertia/flash";
|
|
7
|
-
import {
|
|
7
|
+
import { User } from "../models/User";
|
|
8
|
+
import { AppRuntime } from "../lib/app-manager/AdminizerApp";
|
|
8
9
|
declare global {
|
|
9
10
|
/** @deprecated use import from TS model decalration */
|
|
10
11
|
type ModelsAP = {
|
|
@@ -38,25 +39,20 @@ declare global {
|
|
|
38
39
|
isPublic?: boolean;
|
|
39
40
|
parent?: ModelsAP["MediaManagerAP"];
|
|
40
41
|
};
|
|
41
|
-
NavigationAP: {
|
|
42
|
-
id?: string;
|
|
43
|
-
label: string;
|
|
44
|
-
tree: any;
|
|
45
|
-
};
|
|
46
42
|
};
|
|
47
43
|
type reqSession = {
|
|
48
44
|
flashMessages: Record<string, string[]>;
|
|
49
45
|
xInertiaCurrentComponent: string | undefined;
|
|
50
|
-
|
|
46
|
+
User: User;
|
|
51
47
|
messages: {
|
|
52
48
|
adminError: string[];
|
|
53
49
|
adminSuccess: string[];
|
|
54
50
|
};
|
|
55
|
-
userPretended?:
|
|
51
|
+
userPretended?: User;
|
|
56
52
|
};
|
|
57
53
|
type FlashMessages = 'info' | 'error' | 'success' | string;
|
|
58
54
|
type ReqType = Request & {
|
|
59
|
-
user:
|
|
55
|
+
user: User;
|
|
60
56
|
Inertia: Inertia;
|
|
61
57
|
flash: Flash<FlashMessages>;
|
|
62
58
|
session: reqSession;
|
|
@@ -67,7 +63,11 @@ declare global {
|
|
|
67
63
|
route: {
|
|
68
64
|
[key: string]: string;
|
|
69
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated Will be removed in Adminizer v6. Use `runtime` in app controllers.
|
|
68
|
+
*/
|
|
70
69
|
adminizer: Adminizer;
|
|
70
|
+
runtime: AppRuntime;
|
|
71
71
|
upload: (options?: {
|
|
72
72
|
destination?: string;
|
|
73
73
|
filename?: (file: Express.Multer.File) => string;
|
|
@@ -77,12 +77,7 @@ declare global {
|
|
|
77
77
|
uploadedFileType: string;
|
|
78
78
|
params: Record<string, string>;
|
|
79
79
|
};
|
|
80
|
-
type ResType = Response
|
|
81
|
-
/**
|
|
82
|
-
* @deprecated // TODO delete after finish catalog
|
|
83
|
-
*/
|
|
84
|
-
viewAdmin(specifiedPath: string, locals?: any, cb_view?: Function): void;
|
|
85
|
-
};
|
|
80
|
+
type ResType = Response;
|
|
86
81
|
type MiddlewareType = (req: ReqType, res: ResType, next: NextFunction) => void;
|
|
87
82
|
type PropType<TObj, TProp extends keyof TObj> = TObj[TProp];
|
|
88
83
|
}
|
package/lib/Adminizer.d.ts
CHANGED
|
@@ -14,15 +14,29 @@ import type { ViteDevServer } from 'vite';
|
|
|
14
14
|
import { MenuHelper } from "../helpers/menuHelper";
|
|
15
15
|
import { ControlsHandler } from "./controls/ControlsHandler";
|
|
16
16
|
import { CatalogHandler } from "./catalog/CatalogHandler";
|
|
17
|
+
import { CatalogTemplateComponentHandler } from "./catalog/CatalogTemplateComponentHandler";
|
|
17
18
|
import { AiAssistantHandler } from './ai-assistant/AiAssistantHandler';
|
|
18
19
|
import { NotificationHandler } from './notifications/NotificationHandler';
|
|
19
20
|
import { INotification } from "../interfaces/types";
|
|
20
21
|
import { MediaManagerHandler } from "./media-manager/MediaManagerHandler";
|
|
21
|
-
import { StorageServices } from "./catalog/Navigation";
|
|
22
22
|
import { HistoryHandler } from "./history-actions/HistoryHandler";
|
|
23
23
|
import { CustomFilterHandler } from "./filters/CustomFilterHandler";
|
|
24
24
|
import { FeedbackHandler } from "./feedback/FeedbackHandler";
|
|
25
|
+
import { AppManager } from "./app-manager/AppManager";
|
|
26
|
+
import { ControllerHandler } from "./app-manager/ControllerHandler";
|
|
27
|
+
import { AssetHandler } from "./app-manager/AssetHandler";
|
|
28
|
+
import { ConfigLayerHandler } from "./app-manager/ConfigLayerHandler";
|
|
29
|
+
import { AccessRightsHandler } from "./access-rights/AccessRightsHandler";
|
|
30
|
+
export declare function createAdminizerLogger(): winston.Logger;
|
|
31
|
+
export interface EmitAsyncOptions {
|
|
32
|
+
/**
|
|
33
|
+
* Maximum time to wait for each listener. Set to 0 to disable the timeout.
|
|
34
|
+
* @default 10000
|
|
35
|
+
*/
|
|
36
|
+
timeoutMs?: number;
|
|
37
|
+
}
|
|
25
38
|
export declare class Adminizer {
|
|
39
|
+
private static readonly defaultListenerTimeoutMs;
|
|
26
40
|
/**
|
|
27
41
|
* If you convey this default Middleware, it will add it to the very top of the router,
|
|
28
42
|
* and will contact each request
|
|
@@ -46,9 +60,14 @@ export declare class Adminizer {
|
|
|
46
60
|
vite: ViteDevServer;
|
|
47
61
|
controlsHandler: ControlsHandler;
|
|
48
62
|
catalogHandler: CatalogHandler;
|
|
63
|
+
catalogTemplateComponentHandler: CatalogTemplateComponentHandler;
|
|
49
64
|
mediaManagerHandler: MediaManagerHandler;
|
|
50
|
-
storageServices: StorageServices;
|
|
51
65
|
feedbackHandler: FeedbackHandler;
|
|
66
|
+
appManager: AppManager;
|
|
67
|
+
controllerHandler: ControllerHandler;
|
|
68
|
+
assetHandler: AssetHandler;
|
|
69
|
+
configLayerHandler: ConfigLayerHandler;
|
|
70
|
+
accessRightsHandler: AccessRightsHandler;
|
|
52
71
|
jwtSecret: string;
|
|
53
72
|
static logger: winston.Logger;
|
|
54
73
|
constructor(ormAdapters: AbstractAdapter[]);
|
|
@@ -61,6 +80,10 @@ export declare class Adminizer {
|
|
|
61
80
|
init(config: AdminpanelConfig): Promise<void>;
|
|
62
81
|
sendNotification(notification: Omit<INotification, 'id' | 'createdAt' | 'icon'>): Promise<boolean>;
|
|
63
82
|
get emitter(): EventEmitter;
|
|
83
|
+
/**
|
|
84
|
+
* Runs event listeners and waits for async module side effects before continuing.
|
|
85
|
+
*/
|
|
86
|
+
emitAsync<TPayload = unknown>(event: string | symbol, payload: TPayload, options?: EmitAsyncOptions): Promise<void>;
|
|
64
87
|
getOrmAdapter(ormType: string): AbstractAdapter;
|
|
65
88
|
static get log(): {
|
|
66
89
|
info: (...args: any[]) => winston.Logger;
|
package/lib/Adminizer.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import express from "express";
|
|
2
2
|
import cookieParser from 'cookie-parser';
|
|
3
|
+
import * as fs from "fs";
|
|
3
4
|
import * as path from "path";
|
|
4
5
|
import winston from "winston";
|
|
5
6
|
import chalk from "chalk";
|
|
@@ -9,11 +10,10 @@ import Router from "./../system/Router.js";
|
|
|
9
10
|
import bindAssets from "../system/bindAssets.js";
|
|
10
11
|
import bindDev from "../system/bindDev.js";
|
|
11
12
|
import bindDashboardWidgets from "../system/bindDashboardWidgets.js";
|
|
12
|
-
import { bindNavigation } from "../system/bindNavigation.js";
|
|
13
13
|
import bindMediaManager from "../system/bindMediaManager.js";
|
|
14
14
|
import bindAccessRights from "../system/bindAccessRights.js";
|
|
15
15
|
import bindAuthorization from "../system/bindAuthorization.js";
|
|
16
|
-
import
|
|
16
|
+
import { validateSystemModels } from "../system/validateSystemModels.js";
|
|
17
17
|
import bindTranslations from "../system/bindTranslations.js";
|
|
18
18
|
import { ModelHandler } from "./model/ModelHandler.js";
|
|
19
19
|
import { WidgetHandler } from "./widgets/widgetHandler.js";
|
|
@@ -28,16 +28,67 @@ import { MenuHelper } from "../helpers/menuHelper.js";
|
|
|
28
28
|
import { bindControls } from "../system/bindControls.js";
|
|
29
29
|
import { ControlsHandler } from "./controls/ControlsHandler.js";
|
|
30
30
|
import { CatalogHandler } from "./catalog/CatalogHandler.js";
|
|
31
|
+
import { CatalogTemplateComponentHandler } from "./catalog/CatalogTemplateComponentHandler.js";
|
|
31
32
|
import { v4 as uuid } from "uuid";
|
|
32
33
|
import { bindNotifications } from "../system/bindNotifications.js";
|
|
33
|
-
import { bindAiAssistant } from "../system/bindAiAssistant.js";
|
|
34
34
|
import { MediaManagerHandler } from "./media-manager/MediaManagerHandler.js";
|
|
35
35
|
import { bindCors } from "../system/bindCors.js";
|
|
36
36
|
import bindHistory from "../system/bindHistory.js";
|
|
37
37
|
import bindCustomFilterHandlers from "../system/bindCustomFilterHandlers.js";
|
|
38
38
|
import { FeedbackHandler } from "./feedback/FeedbackHandler.js";
|
|
39
39
|
import { buildInternalModelAccess } from "../system/buildInternalModelAccess.js";
|
|
40
|
+
import { AppManager } from "./app-manager/AppManager.js";
|
|
41
|
+
import { ControllerHandler } from "./app-manager/ControllerHandler.js";
|
|
42
|
+
import { AssetHandler } from "./app-manager/AssetHandler.js";
|
|
43
|
+
import { ConfigLayerHandler } from "./app-manager/ConfigLayerHandler.js";
|
|
44
|
+
import { AccessRightsHandler } from "./access-rights/AccessRightsHandler.js";
|
|
45
|
+
const logFilePath = "logs/app.log";
|
|
46
|
+
function ensureLogDirectory(filePath) {
|
|
47
|
+
const logDirectory = path.dirname(filePath);
|
|
48
|
+
if (logDirectory !== ".") {
|
|
49
|
+
fs.mkdirSync(logDirectory, { recursive: true });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function isFileLoggingEnabled() {
|
|
53
|
+
return ["1", "true", "yes"].includes((process.env.ADMINIZER_LOG_TO_FILE ?? "").toLowerCase());
|
|
54
|
+
}
|
|
55
|
+
export function createAdminizerLogger() {
|
|
56
|
+
const transports = [
|
|
57
|
+
new winston.transports.Console({
|
|
58
|
+
format: winston.format.combine(winston.format.timestamp(), winston.format.printf(({ timestamp, level, message, ...meta }) => {
|
|
59
|
+
const metaString = Object.keys(meta).length ? JSON.stringify(meta) : "";
|
|
60
|
+
const colors = {
|
|
61
|
+
error: chalk.red,
|
|
62
|
+
warn: chalk.yellow,
|
|
63
|
+
info: chalk.green,
|
|
64
|
+
http: chalk.magenta,
|
|
65
|
+
verbose: chalk.cyan,
|
|
66
|
+
debug: chalk.blue,
|
|
67
|
+
silly: chalk.gray,
|
|
68
|
+
};
|
|
69
|
+
const colorize = colors[level] ?? chalk.white;
|
|
70
|
+
const line = `[${timestamp}] ${level.toUpperCase()}: ${message} ${metaString}`;
|
|
71
|
+
return colorize(line);
|
|
72
|
+
}))
|
|
73
|
+
}),
|
|
74
|
+
];
|
|
75
|
+
if (isFileLoggingEnabled()) {
|
|
76
|
+
ensureLogDirectory(logFilePath);
|
|
77
|
+
transports.push(new winston.transports.File({
|
|
78
|
+
filename: logFilePath,
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
return winston.createLogger({
|
|
82
|
+
level: process.env.LOG_LEVEL ?? "debug",
|
|
83
|
+
format: winston.format.combine(winston.format.timestamp(), winston.format.printf(({ timestamp, level, message, ...meta }) => {
|
|
84
|
+
const metaString = Object.keys(meta).length ? JSON.stringify(meta) : "";
|
|
85
|
+
return `[${timestamp}] ${level.toUpperCase()}: ${message} ${metaString}`;
|
|
86
|
+
})),
|
|
87
|
+
transports,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
40
90
|
export class Adminizer {
|
|
91
|
+
static defaultListenerTimeoutMs = 10_000;
|
|
41
92
|
// Preconfigures
|
|
42
93
|
/**
|
|
43
94
|
* If you convey this default Middleware, it will add it to the very top of the router,
|
|
@@ -63,42 +114,36 @@ export class Adminizer {
|
|
|
63
114
|
vite;
|
|
64
115
|
controlsHandler;
|
|
65
116
|
catalogHandler;
|
|
117
|
+
catalogTemplateComponentHandler;
|
|
66
118
|
mediaManagerHandler;
|
|
67
|
-
storageServices;
|
|
68
119
|
feedbackHandler;
|
|
120
|
+
appManager;
|
|
121
|
+
controllerHandler;
|
|
122
|
+
assetHandler;
|
|
123
|
+
configLayerHandler;
|
|
124
|
+
accessRightsHandler;
|
|
69
125
|
// Constants
|
|
70
126
|
jwtSecret = process.env.JWT_SECRET ?? uuid();
|
|
71
|
-
static logger =
|
|
72
|
-
level: process.env.LOG_LEVEL ?? "debug",
|
|
73
|
-
format: winston.format.combine(winston.format.timestamp(), winston.format.printf(({ timestamp, level, message, ...meta }) => {
|
|
74
|
-
const metaString = Object.keys(meta).length ? JSON.stringify(meta) : "";
|
|
75
|
-
return `[${timestamp}] ${level.toUpperCase()}: ${message} ${metaString}`;
|
|
76
|
-
})),
|
|
77
|
-
transports: [
|
|
78
|
-
new winston.transports.Console({
|
|
79
|
-
format: winston.format.combine(winston.format.timestamp(), winston.format.printf(({ timestamp, level, message, ...meta }) => {
|
|
80
|
-
const metaString = Object.keys(meta).length ? JSON.stringify(meta) : "";
|
|
81
|
-
const colors = {
|
|
82
|
-
error: chalk.red,
|
|
83
|
-
warn: chalk.yellow,
|
|
84
|
-
info: chalk.green,
|
|
85
|
-
http: chalk.magenta,
|
|
86
|
-
verbose: chalk.cyan,
|
|
87
|
-
debug: chalk.blue,
|
|
88
|
-
silly: chalk.gray,
|
|
89
|
-
};
|
|
90
|
-
const colorize = colors[level] ?? chalk.white;
|
|
91
|
-
const line = `[${timestamp}] ${level.toUpperCase()}: ${message} ${metaString}`;
|
|
92
|
-
return colorize(line);
|
|
93
|
-
}))
|
|
94
|
-
}),
|
|
95
|
-
new winston.transports.File({ filename: "logs/app.log" }),
|
|
96
|
-
],
|
|
97
|
-
});
|
|
127
|
+
static logger = createAdminizerLogger();
|
|
98
128
|
constructor(ormAdapters) {
|
|
99
129
|
this.app = express();
|
|
100
130
|
this._emitter = new EventEmitter();
|
|
101
131
|
this.ormAdapters = ormAdapters;
|
|
132
|
+
this.modelHandler = new ModelHandler();
|
|
133
|
+
this.middlewareManager = new MiddlewareManager(this);
|
|
134
|
+
this.accessRightsHelper = new AccessRightsHelper(this);
|
|
135
|
+
this.accessRightsHandler = new AccessRightsHandler(this);
|
|
136
|
+
this.configHelper = new ConfigHelper(this);
|
|
137
|
+
this.widgetHandler = new WidgetHandler(this);
|
|
138
|
+
this.controlsHandler = new ControlsHandler();
|
|
139
|
+
this.catalogHandler = new CatalogHandler();
|
|
140
|
+
this.catalogTemplateComponentHandler = new CatalogTemplateComponentHandler();
|
|
141
|
+
this.mediaManagerHandler = new MediaManagerHandler();
|
|
142
|
+
this.feedbackHandler = new FeedbackHandler(this);
|
|
143
|
+
this.controllerHandler = new ControllerHandler(this);
|
|
144
|
+
this.assetHandler = new AssetHandler(this);
|
|
145
|
+
this.configLayerHandler = new ConfigLayerHandler(this);
|
|
146
|
+
this.appManager = new AppManager(this);
|
|
102
147
|
}
|
|
103
148
|
getMiddleware() {
|
|
104
149
|
return (req, res, next) => {
|
|
@@ -192,22 +237,14 @@ export class Adminizer {
|
|
|
192
237
|
if (isViteDev)
|
|
193
238
|
await this.viteMiddleware();
|
|
194
239
|
this.emitter.emit('adminizer:init');
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
await bindModels(this);
|
|
240
|
+
// validate models
|
|
241
|
+
validateSystemModels(this);
|
|
198
242
|
this.modelHandler.configureInternalAccess(buildInternalModelAccess(this.config, this.modelHandler));
|
|
199
243
|
bindCustomFilterHandlers(this);
|
|
200
244
|
this.config.rootPath = path.resolve(import.meta.dirname + "/..");
|
|
201
|
-
this.middlewareManager = new MiddlewareManager(this);
|
|
202
245
|
await this.middlewareManager.loadMiddlewares();
|
|
203
246
|
// TODO: 'hot reload' problem with deleting access right tokens
|
|
204
|
-
this.accessRightsHelper = new AccessRightsHelper(this);
|
|
205
|
-
// Helpers go to construtor
|
|
206
|
-
this.configHelper = new ConfigHelper(this);
|
|
207
247
|
this.menuHelper = new MenuHelper(this.config);
|
|
208
|
-
this.widgetHandler = new WidgetHandler(this);
|
|
209
|
-
this.catalogHandler = new CatalogHandler();
|
|
210
|
-
this.mediaManagerHandler = new MediaManagerHandler();
|
|
211
248
|
bindExpressUtils(this.app);
|
|
212
249
|
bindReqFunctions(this);
|
|
213
250
|
// Bind assets
|
|
@@ -217,8 +254,7 @@ export class Adminizer {
|
|
|
217
254
|
bindDev(this);
|
|
218
255
|
}
|
|
219
256
|
}
|
|
220
|
-
|
|
221
|
-
await bindNavigation(this);
|
|
257
|
+
bindDashboardWidgets(this);
|
|
222
258
|
bindMediaManager(this);
|
|
223
259
|
await bindAccessRights(this);
|
|
224
260
|
if (I18n.appendLocale) {
|
|
@@ -228,20 +264,15 @@ export class Adminizer {
|
|
|
228
264
|
this.config.translation = false;
|
|
229
265
|
}
|
|
230
266
|
//bind controls
|
|
231
|
-
this.controlsHandler = new ControlsHandler();
|
|
232
267
|
bindControls(this);
|
|
233
268
|
// bind Inertia
|
|
234
269
|
bindInertia(this);
|
|
235
270
|
await bindAuthorization(this);
|
|
236
271
|
// Bind notifications
|
|
237
272
|
if (this.config.notifications.enabled)
|
|
238
|
-
|
|
239
|
-
if (this.config.aiAssistant?.enabled)
|
|
240
|
-
await bindAiAssistant(this);
|
|
273
|
+
bindNotifications(this);
|
|
241
274
|
if (this.config.history?.enabled)
|
|
242
|
-
|
|
243
|
-
// FeedbackHandler registers its own route lazily when handler.register() is called
|
|
244
|
-
this.feedbackHandler = new FeedbackHandler(this);
|
|
275
|
+
bindHistory(this);
|
|
245
276
|
this.router = new Router(this);
|
|
246
277
|
await this.router.bind(); // must be after binding policies and req/res functions
|
|
247
278
|
/**
|
|
@@ -263,6 +294,49 @@ export class Adminizer {
|
|
|
263
294
|
get emitter() {
|
|
264
295
|
return this._emitter;
|
|
265
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* Runs event listeners and waits for async module side effects before continuing.
|
|
299
|
+
*/
|
|
300
|
+
async emitAsync(event, payload, options = {}) {
|
|
301
|
+
const timeoutMs = options.timeoutMs ?? Adminizer.defaultListenerTimeoutMs;
|
|
302
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs < 0) {
|
|
303
|
+
throw new RangeError("emitAsync timeoutMs must be a finite non-negative number");
|
|
304
|
+
}
|
|
305
|
+
await Promise.all(this._emitter.listeners(event).map(async (listener, listenerIndex) => {
|
|
306
|
+
const listenerName = listener.name || "<anonymous>";
|
|
307
|
+
let timeout;
|
|
308
|
+
try {
|
|
309
|
+
const listenerPromise = Promise.resolve().then(() => listener.call(this._emitter, payload));
|
|
310
|
+
if (timeoutMs === 0) {
|
|
311
|
+
await listenerPromise;
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
315
|
+
timeout = setTimeout(() => {
|
|
316
|
+
reject(new Error(`Listener "${listenerName}" for event "${String(event)}" timed out after ${timeoutMs} ms`));
|
|
317
|
+
}, timeoutMs);
|
|
318
|
+
});
|
|
319
|
+
await Promise.race([listenerPromise, timeoutPromise]);
|
|
320
|
+
}
|
|
321
|
+
catch (error) {
|
|
322
|
+
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
323
|
+
Adminizer.logger.error("Async event listener failed", {
|
|
324
|
+
event: String(event),
|
|
325
|
+
listener: listenerName,
|
|
326
|
+
listenerIndex,
|
|
327
|
+
timeoutMs,
|
|
328
|
+
error: normalizedError.message,
|
|
329
|
+
stack: normalizedError.stack,
|
|
330
|
+
});
|
|
331
|
+
throw error;
|
|
332
|
+
}
|
|
333
|
+
finally {
|
|
334
|
+
if (timeout) {
|
|
335
|
+
clearTimeout(timeout);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}));
|
|
339
|
+
}
|
|
266
340
|
getOrmAdapter(ormType) {
|
|
267
341
|
return this.ormAdapters.find(item => item.ormType === ormType);
|
|
268
342
|
}
|
package/lib/DataAccessor.d.ts
CHANGED
|
@@ -5,18 +5,19 @@ import { ModelResource } from "../interfaces/types";
|
|
|
5
5
|
import { ActionType } from "../interfaces/adminpanelConfig";
|
|
6
6
|
import { Fields } from "../helpers/fieldsHelper";
|
|
7
7
|
import { Adminizer } from "./Adminizer";
|
|
8
|
-
import {
|
|
8
|
+
import { User } from "../models/User";
|
|
9
9
|
import { QueryCriteria } from "../interfaces/queryCriteria";
|
|
10
10
|
export declare class DataAccessor {
|
|
11
11
|
readonly adminizer: Adminizer;
|
|
12
|
-
user:
|
|
12
|
+
user: User;
|
|
13
13
|
modelResource: ModelResource;
|
|
14
14
|
action: ActionType;
|
|
15
15
|
private fields;
|
|
16
16
|
private actionVerb;
|
|
17
|
-
constructor(adminizer: Adminizer, user:
|
|
17
|
+
constructor(adminizer: Adminizer, user: User, modelResource: ModelResource, action: ActionType);
|
|
18
18
|
private getModelConfig;
|
|
19
19
|
private accessRelationModel;
|
|
20
|
+
private resolveRelationTarget;
|
|
20
21
|
/**
|
|
21
22
|
* Retrieves the fields for the given ModelResource based on action type,
|
|
22
23
|
* taking into account access rights and configuration settings.
|
|
@@ -26,14 +27,17 @@ export declare class DataAccessor {
|
|
|
26
27
|
private orderFieldsByConfig;
|
|
27
28
|
private getAssociatedFieldsConfig;
|
|
28
29
|
private checkFieldAccess;
|
|
30
|
+
private getSelectedFields;
|
|
31
|
+
private getPopulateCriteria;
|
|
32
|
+
private canUseSelectedFieldFallback;
|
|
29
33
|
/**
|
|
30
34
|
* Returns filtered record applying config from this.fields on this record
|
|
31
35
|
* @data - record from a specific model */
|
|
32
|
-
process<T>(record: T): Partial<T>;
|
|
36
|
+
process<T>(record: T, criteria?: QueryCriteria): Partial<T>;
|
|
33
37
|
/** Filters associated records (simplified process() function) */
|
|
34
38
|
private filterAssociatedRecord;
|
|
35
39
|
/** Process for an array of records */
|
|
36
|
-
processMany<T>(records: T[]): Partial<T>[];
|
|
40
|
+
processMany<T>(records: T[], criteria?: QueryCriteria): Partial<T>[];
|
|
37
41
|
sanitizeUserRelationAccess(criteria?: QueryCriteria): Promise<QueryCriteria>;
|
|
38
42
|
setUserRelationAccess<T>(record: T): Promise<Partial<T>>;
|
|
39
43
|
}
|