adminizer 4.3.0-build.80 → 4.3.0-build.82
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/assets/add-CZdDpNV2.js +1 -0
- package/assets/add-form-BjXOLDij.js +1 -0
- package/assets/add-group-form-BNmpvW8K.js +1 -0
- package/assets/add-group-urhA47Qf.js +1 -0
- package/assets/add-user-CzWUu7wG.js +1 -0
- package/assets/{add-user-form-yp020h4r.js → add-user-form-DrclnTOd.js} +1 -1
- package/assets/{app-CpGtjhxF.css → app-CSVBI-Lw.css} +1 -1
- package/assets/app-layout-CbyH1MDK.js +1 -0
- package/assets/{app-shell-xEVbINZV.js → app-shell-CHEYhVco.js} +1 -1
- package/assets/{app-sidebar-4lm9f_CG.js → app-sidebar-DeF8WNmW.js} +1 -1
- package/assets/app-sidebar-header-8KWnVpkN.js +1 -0
- package/assets/app.js +1628 -1628
- package/assets/breadcrumbs-C439DWrC.js +1 -0
- package/assets/catalog-CCSagWKW.js +6 -0
- package/assets/dashboard-DUNXib6b.js +3 -0
- package/assets/date-picker-DbJ8nHp5.js +1 -0
- package/assets/del-modal-_b3CSNHb.js +1 -0
- package/assets/{dynamic-controls-PxBg8yMz.js → dynamic-controls-BOYmRX_z.js} +1 -1
- package/assets/{field-renderer-CsBa_tMB.css → field-renderer-CRNLShJD.css} +1 -1
- package/assets/field-renderer-D0crIeQS.js +407 -0
- package/assets/{form-CSTeMDf5.js → form-B6LFaTgS.js} +1 -1
- package/assets/form-C8pRhEOA.js +1 -0
- package/assets/geo-json-uSUIgJf5.js +4 -0
- package/assets/{handsontable-D6MvFmcM.js → handsontable-PVakPtJV.js} +55 -55
- package/assets/home-D--JrFFj.js +2 -0
- package/assets/icon-DM49pZW3.js +1 -0
- package/assets/{init-user-L-oxFTOv.js → init-user-DNrB8Xt5.js} +1 -1
- package/assets/input-error--IOnWghB.js +1 -0
- package/assets/jsoneditor-D95dIAP2.js +3878 -0
- package/assets/list-CQivvagG.js +1 -0
- package/assets/{list-table-vIvydJV2.js → list-table-h_zXp43g.js} +4 -4
- package/assets/{login-DLMJ6l_r.js → login-6Xb8bcPq.js} +1 -1
- package/assets/manifest.json +259 -260
- package/assets/material-icon-BedgD2NE.js +1 -0
- package/assets/{media-manager-ASGJ4PcS.js → media-manager-Bms57WSN.js} +2 -2
- package/assets/module-DqrIORMW.js +1 -0
- package/assets/{monaco-B1uVVM7f.js → monaco-ICtx6xoc.js} +1 -1
- package/assets/{nav-footer-DbGCtmmN.js → nav-footer-BwkQkwow.js} +1 -1
- package/assets/{nav-main-BcWhl71g.js → nav-main-9Eb_A0rf.js} +1 -1
- package/assets/nav-user-CRAfyE-x.js +1 -0
- package/assets/notification-db0RD9I6.js +27 -0
- package/assets/{pagination-render-BceTnewI.js → pagination-render-D3UyVAlr.js} +1 -1
- package/assets/{register-C_W_hOmq.js → register-BIyjCy8M.js} +1 -1
- package/assets/tabs-BK_5wdPA.js +1 -0
- package/assets/theme-switcher-CKiJbMkh.js +1 -0
- package/assets/toast-editor-BZM5RHph.js +845 -0
- package/assets/{user-info-BrWerGLc.js → user-info-CcYdmjMZ.js} +1 -1
- package/assets/{user-menu-content-D61_auxX.js → user-menu-content-DbUk8ZeY.js} +1 -1
- package/assets/vanilla-picker-l5rcX3cq.js +8 -0
- package/assets/{vendor-DoC2WAmd.js → vendor-wzZzN_Jv.js} +2 -2
- package/assets/welcome-CZlWN4gM.js +1 -0
- package/controllers/add.js +1 -1
- package/controllers/catalog/FrontentCatalogAdapter.d.ts +4 -4
- package/controllers/edit.js +1 -15
- package/controllers/list.js +2 -2
- package/controllers/login.js +2 -2
- package/controllers/navigation/edit.js +1 -1
- package/controllers/notifications/NotificationController.d.ts +5 -5
- package/controllers/notifications/NotificationController.js +77 -78
- package/controllers/remove.js +1 -11
- package/controllers/view.js +1 -1
- package/helpers/configHelper.d.ts +1 -1
- package/helpers/fieldsHelper.d.ts +1 -1
- package/helpers/fieldsHelper.js +1 -1
- package/helpers/inertiaAddHelper.d.ts +1 -1
- package/helpers/translationHelper.d.ts +1 -1
- package/helpers/translationHelper.js +1 -1
- package/index.d.ts +14 -13
- package/index.js +14 -13
- package/interfaces/adminpanelConfig.d.ts +1 -1
- package/interfaces/global.d.ts +3 -3
- package/interfaces/types.d.ts +10 -1
- package/lib/Adminizer.d.ts +7 -7
- package/lib/Adminizer.js +7 -7
- package/lib/{v4/DataAccessor.d.ts → DataAccessor.d.ts} +4 -4
- package/lib/{v4/DataAccessor.js → DataAccessor.js} +3 -3
- package/lib/{v4/I18n.js → I18n.js} +2 -2
- package/lib/{v4/PolicyManager.d.ts → PolicyManager.d.ts} +1 -1
- package/lib/{v4/PolicyManager.js → PolicyManager.js} +2 -2
- package/lib/{v4/catalog → catalog}/AbstractCatalog.d.ts +1 -1
- package/lib/{v4/catalog → catalog}/Navigation.d.ts +2 -2
- package/lib/{v4/catalog → catalog}/Navigation.js +1 -1
- package/lib/{v4/controls → controls}/AbstractControls.d.ts +1 -1
- package/lib/{v4/controls → controls}/codeEditor/MonacoEditor.d.ts +1 -1
- package/lib/{v4/controls → controls}/geojsoneditor/GeoEditor.d.ts +1 -1
- package/lib/{v4/controls → controls}/jsoneditor/JsonEditor.d.ts +1 -1
- package/lib/{v4/controls → controls}/markdown/ToastUiEditor.d.ts +1 -1
- package/lib/{v4/controls → controls}/table/Handsontable.d.ts +1 -1
- package/lib/{v4/controls → controls}/wysiwyg/CKeditor.d.ts +1 -1
- package/lib/{v4/datatable → datatable}/NodeTable.d.ts +1 -1
- package/lib/{v4/model → model}/AbstractModel.d.ts +12 -0
- package/lib/model/AbstractModel.js +178 -0
- package/lib/{v4/model → model}/ModelHandler.js +1 -1
- package/lib/{v4/model → model}/adapter/sequelize.d.ts +2 -4
- package/lib/{v4/model → model}/adapter/sequelize.js +33 -13
- package/lib/{v4/notifications → notifications}/AbstractNotificationService.d.ts +14 -7
- package/lib/notifications/AbstractNotificationService.js +233 -0
- package/lib/{v4/notifications → notifications}/GeneralNotificationService.d.ts +1 -1
- package/lib/{v4/notifications → notifications}/GeneralNotificationService.js +4 -2
- package/lib/notifications/NotificationHandler.d.ts +27 -0
- package/lib/notifications/NotificationHandler.js +41 -0
- package/lib/{v4/notifications → notifications}/SystemNotificationService.d.ts +5 -4
- package/lib/notifications/SystemNotificationService.js +173 -0
- package/lib/{v4/widgets → widgets}/abstractCustom.d.ts +1 -1
- package/lib/{v4/widgets → widgets}/abstractLink.d.ts +1 -1
- package/lib/{v4/widgets → widgets}/abstractWidgetBase.d.ts +1 -1
- package/lib/{v4/widgets → widgets}/widgetHandler.d.ts +2 -2
- package/migrations/index.d.ts +3 -0
- package/migrations/index.js +4 -0
- package/migrations/umzug/0001.d.ts +7 -0
- package/migrations/umzug/0001.js +119 -0
- package/migrations/umzug.d.ts +2 -0
- package/migrations/umzug.js +8 -0
- package/models/NotificationAP.d.ts +8 -0
- package/models/NotificationAP.js +8 -0
- package/models/UserAP.d.ts +1 -1
- package/package.json +5 -4
- package/system/Router.js +4 -8
- package/system/bindControls.js +6 -6
- package/system/bindInertia.js +4 -3
- package/system/bindNavigation.js +1 -1
- package/system/bindNotifications.js +3 -3
- package/system/bindReqFunctions.js +8 -25
- package/system/defaults.js +1 -1
- package/ui/components/ui/table.d.ts +1 -1
- package/ui/components/ui/table.js +2 -2
- package/assets/add-DSapOiv0.js +0 -1
- package/assets/add-form-C04ZI5LT.js +0 -1
- package/assets/add-group-DWR7SBTO.js +0 -1
- package/assets/add-group-form-CyRwxTs3.js +0 -1
- package/assets/add-user-acATGxUL.js +0 -1
- package/assets/app-layout-BmT5KQwc.js +0 -1
- package/assets/app-sidebar-header-CxXmzszq.js +0 -1
- package/assets/breadcrumbs-livOfa2Z.js +0 -1
- package/assets/catalog-CG_EB2kz.js +0 -6
- package/assets/dashboard-CsmJfdLb.js +0 -3
- package/assets/date-picker-By3kj-Rx.js +0 -1
- package/assets/del-modal-DlcbcdR5.js +0 -1
- package/assets/field-renderer-Bp1lfm0v.js +0 -407
- package/assets/form-CxHRGp7p.js +0 -1
- package/assets/geo-json-CCgjEQfu.js +0 -4
- package/assets/home-D00XjLjD.js +0 -2
- package/assets/icon-ButfCBrt.js +0 -1
- package/assets/input-error-CHsDLcK0.js +0 -1
- package/assets/jsoneditor-CBqATVR0.js +0 -3833
- package/assets/list-4TOTsjqE.js +0 -1
- package/assets/material-icon-sXk4BK-N.js +0 -1
- package/assets/module-mxngd2cA.js +0 -1
- package/assets/nav-user-BN2veV3l.js +0 -1
- package/assets/notification-BEfA5sT6.js +0 -1
- package/assets/tabs-CgZW_LLn.js +0 -1
- package/assets/theme-switcher-D1G6OSMc.js +0 -1
- package/assets/toast-editor-CfgZXoQZ.js +0 -845
- package/assets/vanilla-picker-B6E6ObS_.js +0 -8
- package/assets/welcome-FHRCdke0.js +0 -1
- package/lib/v4/model/AbstractModel.js +0 -79
- package/lib/v4/notifications/AbstractNotificationService.js +0 -150
- package/lib/v4/notifications/NotificationHandler.d.ts +0 -69
- package/lib/v4/notifications/NotificationHandler.js +0 -127
- package/lib/v4/notifications/SystemNotificationService.js +0 -124
- package/migrations/db-migrate/20230303171134-adminpanel-init.js +0 -122
- package/migrations/db-migrate/20231223215835-add-widgets.js +0 -32
- package/migrations/db-migrate/20240804191001-added-navigationap.js +0 -53
- package/migrations/db-migrate/20241121184236-v4-init.js +0 -134
- /package/lib/{v4/I18n.d.ts → I18n.d.ts} +0 -0
- /package/lib/{v4/POWCaptcha.d.ts → POWCaptcha.d.ts} +0 -0
- /package/lib/{v4/POWCaptcha.js → POWCaptcha.js} +0 -0
- /package/lib/{v4/catalog → catalog}/AbstractCatalog.js +0 -0
- /package/lib/{v4/catalog → catalog}/CatalogHandler.d.ts +0 -0
- /package/lib/{v4/catalog → catalog}/CatalogHandler.js +0 -0
- /package/lib/{v4/controls → controls}/AbstractControls.js +0 -0
- /package/lib/{v4/controls → controls}/ControlsHandler.d.ts +0 -0
- /package/lib/{v4/controls → controls}/ControlsHandler.js +0 -0
- /package/lib/{v4/controls → controls}/codeEditor/MonacoEditor.js +0 -0
- /package/lib/{v4/controls → controls}/geojsoneditor/GeoEditor.js +0 -0
- /package/lib/{v4/controls → controls}/jsoneditor/JsonEditor.js +0 -0
- /package/lib/{v4/controls → controls}/markdown/ToastUiEditor.js +0 -0
- /package/lib/{v4/controls → controls}/table/Handsontable.js +0 -0
- /package/lib/{v4/controls → controls}/wysiwyg/CKeditor.js +0 -0
- /package/lib/{v4/datatable → datatable}/NodeTable.js +0 -0
- /package/lib/{v4/helper → helper}/jwt.d.ts +0 -0
- /package/lib/{v4/helper → helper}/jwt.js +0 -0
- /package/lib/{v4/inertia → inertia}/flash.d.ts +0 -0
- /package/lib/{v4/inertia → inertia}/flash.js +0 -0
- /package/lib/{v4/inertia → inertia}/inertiaAdapter.d.ts +0 -0
- /package/lib/{v4/inertia → inertia}/inertiaAdapter.js +0 -0
- /package/lib/{v4/model → model}/ModelHandler.d.ts +0 -0
- /package/lib/{v4/model → model}/adapter/waterline.d.ts +0 -0
- /package/lib/{v4/model → model}/adapter/waterline.js +0 -0
- /package/lib/{v4/widgets → widgets}/abstractAction.d.ts +0 -0
- /package/lib/{v4/widgets → widgets}/abstractAction.js +0 -0
- /package/lib/{v4/widgets → widgets}/abstractCustom.js +0 -0
- /package/lib/{v4/widgets → widgets}/abstractInfo.d.ts +0 -0
- /package/lib/{v4/widgets → widgets}/abstractInfo.js +0 -0
- /package/lib/{v4/widgets → widgets}/abstractLink.js +0 -0
- /package/lib/{v4/widgets → widgets}/abstractSwitch.d.ts +0 -0
- /package/lib/{v4/widgets → widgets}/abstractSwitch.js +0 -0
- /package/lib/{v4/widgets → widgets}/abstractWidgetBase.js +0 -0
- /package/lib/{v4/widgets → widgets}/widgetHandler.js +0 -0
package/index.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
export * from "./helpers/configHelper";
|
|
2
2
|
export * from "./helpers/accessRightsHelper";
|
|
3
|
-
export * from "./lib/
|
|
4
|
-
export * from "./lib/
|
|
5
|
-
export * from "./lib/
|
|
6
|
-
export * from "./lib/
|
|
7
|
-
export * from "./lib/
|
|
8
|
-
export * from "./lib/
|
|
9
|
-
export * from "./lib/
|
|
10
|
-
export * from "./lib/
|
|
11
|
-
export * from "./lib/
|
|
12
|
-
export * from "./lib/
|
|
3
|
+
export * from "./lib/widgets/abstractAction";
|
|
4
|
+
export * from "./lib/widgets/abstractInfo";
|
|
5
|
+
export * from "./lib/widgets/abstractCustom";
|
|
6
|
+
export * from "./lib/widgets/abstractLink";
|
|
7
|
+
export * from "./lib/widgets/abstractWidgetBase";
|
|
8
|
+
export * from "./lib/widgets/abstractSwitch";
|
|
9
|
+
export * from "./lib/widgets/widgetHandler";
|
|
10
|
+
export * from "./lib/catalog/AbstractCatalog";
|
|
11
|
+
export * from "./lib/catalog/Navigation";
|
|
12
|
+
export * from "./lib/catalog/CatalogHandler";
|
|
13
13
|
export * from "./lib/media-manager/MediaManagerHandler";
|
|
14
14
|
export * from "./interfaces/adminpanelConfig";
|
|
15
15
|
export * from "./interfaces/types";
|
|
16
16
|
export * from "./interfaces/MaaterialIcons";
|
|
17
|
-
export * from "./lib/
|
|
18
|
-
export * from "./lib/
|
|
19
|
-
export * from "./lib/
|
|
17
|
+
export * from "./lib/model/AbstractModel";
|
|
18
|
+
export * from "./lib/model/adapter/waterline";
|
|
19
|
+
export * from "./lib/model/adapter/sequelize";
|
|
20
20
|
export * from "./lib/Adminizer";
|
|
21
21
|
export * from "./models/GroupAP";
|
|
22
22
|
export * from "./models/UserAP";
|
|
@@ -24,3 +24,4 @@ export * from "./models/MediaManagerAP";
|
|
|
24
24
|
export * from "./models/MediaManagerAssociationsAP";
|
|
25
25
|
export * from "./models/MediaManagerMetaAP";
|
|
26
26
|
export * from "./models/NavigationAP";
|
|
27
|
+
export * from "./migrations";
|
package/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
export * from "./helpers/configHelper";
|
|
2
2
|
export * from "./helpers/accessRightsHelper";
|
|
3
|
-
export * from "./lib/
|
|
4
|
-
export * from "./lib/
|
|
5
|
-
export * from "./lib/
|
|
6
|
-
export * from "./lib/
|
|
7
|
-
export * from "./lib/
|
|
8
|
-
export * from "./lib/
|
|
9
|
-
export * from "./lib/
|
|
10
|
-
export * from "./lib/
|
|
11
|
-
export * from "./lib/
|
|
12
|
-
export * from "./lib/
|
|
3
|
+
export * from "./lib/widgets/abstractAction";
|
|
4
|
+
export * from "./lib/widgets/abstractInfo";
|
|
5
|
+
export * from "./lib/widgets/abstractCustom";
|
|
6
|
+
export * from "./lib/widgets/abstractLink";
|
|
7
|
+
export * from "./lib/widgets/abstractWidgetBase";
|
|
8
|
+
export * from "./lib/widgets/abstractSwitch";
|
|
9
|
+
export * from "./lib/widgets/widgetHandler";
|
|
10
|
+
export * from "./lib/catalog/AbstractCatalog";
|
|
11
|
+
export * from "./lib/catalog/Navigation";
|
|
12
|
+
export * from "./lib/catalog/CatalogHandler";
|
|
13
13
|
export * from "./lib/media-manager/MediaManagerHandler";
|
|
14
14
|
export * from "./interfaces/adminpanelConfig";
|
|
15
15
|
export * from "./interfaces/types";
|
|
16
16
|
export * from "./interfaces/MaaterialIcons";
|
|
17
|
-
export * from "./lib/
|
|
18
|
-
export * from "./lib/
|
|
19
|
-
export * from "./lib/
|
|
17
|
+
export * from "./lib/model/AbstractModel";
|
|
18
|
+
export * from "./lib/model/adapter/waterline";
|
|
19
|
+
export * from "./lib/model/adapter/sequelize";
|
|
20
20
|
export * from "./lib/Adminizer";
|
|
21
21
|
export * from "./models/GroupAP";
|
|
22
22
|
export * from "./models/UserAP";
|
|
@@ -24,3 +24,4 @@ export * from "./models/MediaManagerAP";
|
|
|
24
24
|
export * from "./models/MediaManagerAssociationsAP";
|
|
25
25
|
export * from "./models/MediaManagerMetaAP";
|
|
26
26
|
export * from "./models/NavigationAP";
|
|
27
|
+
export * from "./migrations";
|
package/interfaces/global.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Adminizer } from "../lib/Adminizer";
|
|
2
2
|
import { NextFunction, Request, Response } from "express";
|
|
3
3
|
import multer from "multer";
|
|
4
|
-
import { I18n } from "../lib/
|
|
5
|
-
import { Inertia } from "../lib/
|
|
6
|
-
import { Flash } from "../lib/
|
|
4
|
+
import { I18n } from "../lib/I18n";
|
|
5
|
+
import { Inertia } from "../lib/inertia/inertiaAdapter";
|
|
6
|
+
import { Flash } from "../lib/inertia/flash";
|
|
7
7
|
import { UserAP } from "models/UserAP";
|
|
8
8
|
declare global {
|
|
9
9
|
/** @deprecated use import from TS model decalration */
|
package/interfaces/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractModel } from "../lib/
|
|
1
|
+
import { AbstractModel } from "../lib/model/AbstractModel";
|
|
2
2
|
import { ModelConfig } from "./adminpanelConfig";
|
|
3
3
|
export type EntityType = "form" | "model";
|
|
4
4
|
export interface Entity {
|
|
@@ -57,3 +57,12 @@ export interface INotificationEvent {
|
|
|
57
57
|
channel?: string;
|
|
58
58
|
userId?: number;
|
|
59
59
|
}
|
|
60
|
+
export type Migration = {
|
|
61
|
+
name: string;
|
|
62
|
+
up: (args: {
|
|
63
|
+
context: any;
|
|
64
|
+
}) => Promise<unknown> | unknown;
|
|
65
|
+
down: (args: {
|
|
66
|
+
context: any;
|
|
67
|
+
}) => Promise<unknown> | unknown;
|
|
68
|
+
};
|
package/lib/Adminizer.d.ts
CHANGED
|
@@ -2,17 +2,17 @@ import express, { Express } from "express";
|
|
|
2
2
|
import winston from "winston";
|
|
3
3
|
import EventEmitter from 'events';
|
|
4
4
|
import { AdminpanelConfig } from "../interfaces/adminpanelConfig";
|
|
5
|
-
import PolicyManager from "./
|
|
6
|
-
import { ModelHandler } from "./
|
|
7
|
-
import { WidgetHandler } from "./
|
|
5
|
+
import PolicyManager from "./PolicyManager";
|
|
6
|
+
import { ModelHandler } from "./model/ModelHandler";
|
|
7
|
+
import { WidgetHandler } from "./widgets/widgetHandler";
|
|
8
8
|
import { AccessRightsHelper } from "../helpers/accessRightsHelper";
|
|
9
9
|
import { ConfigHelper } from "../helpers/configHelper";
|
|
10
|
-
import { AbstractAdapter } from "./
|
|
10
|
+
import { AbstractAdapter } from "./model/AbstractModel";
|
|
11
11
|
import type { ViteDevServer } from 'vite';
|
|
12
12
|
import { MenuHelper } from "../helpers/menuHelper";
|
|
13
|
-
import { ControlsHandler } from "./
|
|
14
|
-
import { CatalogHandler } from "./
|
|
15
|
-
import { NotificationHandler } from './
|
|
13
|
+
import { ControlsHandler } from "./controls/ControlsHandler";
|
|
14
|
+
import { CatalogHandler } from "./catalog/CatalogHandler";
|
|
15
|
+
import { NotificationHandler } from './notifications/NotificationHandler';
|
|
16
16
|
import { INotification } from "../interfaces/types";
|
|
17
17
|
export declare class Adminizer {
|
|
18
18
|
/**
|
package/lib/Adminizer.js
CHANGED
|
@@ -3,7 +3,7 @@ import cookieParser from 'cookie-parser';
|
|
|
3
3
|
import * as path from "path";
|
|
4
4
|
import winston from "winston";
|
|
5
5
|
import EventEmitter from 'events';
|
|
6
|
-
import PolicyManager from "./
|
|
6
|
+
import PolicyManager from "./PolicyManager";
|
|
7
7
|
import Router from "./../system/Router";
|
|
8
8
|
import bindAssets from "../system/bindAssets";
|
|
9
9
|
import bindDev from "../system/bindDev";
|
|
@@ -15,19 +15,19 @@ import bindAuthorization from "../system/bindAuthorization";
|
|
|
15
15
|
import bindModels from "../system/bindModels";
|
|
16
16
|
import bindForms from "../system/bindForms";
|
|
17
17
|
import bindTranslations from "../system/bindTranslations";
|
|
18
|
-
import { ModelHandler } from "./
|
|
19
|
-
import { WidgetHandler } from "./
|
|
18
|
+
import { ModelHandler } from "./model/ModelHandler";
|
|
19
|
+
import { WidgetHandler } from "./widgets/widgetHandler";
|
|
20
20
|
import { AccessRightsHelper } from "../helpers/accessRightsHelper";
|
|
21
21
|
import bindReqFunctions from "../system/bindReqFunctions";
|
|
22
22
|
import { ConfigHelper } from "../helpers/configHelper";
|
|
23
|
-
import { I18n } from "./
|
|
23
|
+
import { I18n } from "./I18n";
|
|
24
24
|
import { getDefaultConfig } from "../system/defaults";
|
|
25
25
|
import bindExpressUtils from "../system/bindExpressUtils";
|
|
26
26
|
import { bindInertia } from "../system/bindInertia";
|
|
27
27
|
import { MenuHelper } from "../helpers/menuHelper";
|
|
28
28
|
import { bindControls } from "../system/bindControls";
|
|
29
|
-
import { ControlsHandler } from "./
|
|
30
|
-
import { CatalogHandler } from "./
|
|
29
|
+
import { ControlsHandler } from "./controls/ControlsHandler";
|
|
30
|
+
import { CatalogHandler } from "./catalog/CatalogHandler";
|
|
31
31
|
import { v4 as uuid } from "uuid";
|
|
32
32
|
import { bindNotifications } from "../system/bindNotifications";
|
|
33
33
|
export class Adminizer {
|
|
@@ -199,7 +199,7 @@ export class Adminizer {
|
|
|
199
199
|
bindInertia(this);
|
|
200
200
|
await bindAuthorization(this);
|
|
201
201
|
// Bind notifications
|
|
202
|
-
if (this.config.
|
|
202
|
+
if (this.config.notifications.enabled)
|
|
203
203
|
await bindNotifications(this);
|
|
204
204
|
await Router.bind(this); // must be after binding policies and req/res functions
|
|
205
205
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The class manages the interaction between the user and the database entry, taking into account user permissions and the main config file settings.
|
|
3
3
|
*/
|
|
4
|
-
import { Entity } from "
|
|
5
|
-
import { ActionType } from "
|
|
6
|
-
import { Fields } from "
|
|
7
|
-
import { Adminizer } from "
|
|
4
|
+
import { Entity } from "../interfaces/types";
|
|
5
|
+
import { ActionType } from "../interfaces/adminpanelConfig";
|
|
6
|
+
import { Fields } from "../helpers/fieldsHelper";
|
|
7
|
+
import { Adminizer } from "./Adminizer";
|
|
8
8
|
import { UserAP } from "models/UserAP";
|
|
9
9
|
export declare class DataAccessor {
|
|
10
10
|
readonly adminizer: Adminizer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ControllerHelper } from "
|
|
2
|
-
import { Adminizer } from "
|
|
3
|
-
import { isObject } from "
|
|
1
|
+
import { ControllerHelper } from "../helpers/controllerHelper";
|
|
2
|
+
import { Adminizer } from "./Adminizer";
|
|
3
|
+
import { isObject } from "../helpers/JsUtils";
|
|
4
4
|
export class DataAccessor {
|
|
5
5
|
adminizer;
|
|
6
6
|
user;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { vsprintf } from "sprintf-js";
|
|
4
|
-
import { Adminizer } from "
|
|
4
|
+
import { Adminizer } from "./Adminizer";
|
|
5
5
|
export class I18n {
|
|
6
6
|
devMode;
|
|
7
7
|
static locales = {};
|
|
@@ -18,7 +18,7 @@ export class I18n {
|
|
|
18
18
|
constructor(options = {}) {
|
|
19
19
|
this.devMode = process.env.NODE_ENV !== "production";
|
|
20
20
|
this.defaultLocale = options.defaultLocale || "en";
|
|
21
|
-
this.directory = options.directory || path.join(import.meta.filename, '
|
|
21
|
+
this.directory = options.directory || path.join(import.meta.filename, '../../translations');
|
|
22
22
|
this.extension = options.extension || ".json";
|
|
23
23
|
this.cookieName = options.cookieName || "lang";
|
|
24
24
|
this.sessionVarName = options.sessionVarName || "locale";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import * as path from "path";
|
|
3
|
-
import { Adminizer } from "
|
|
3
|
+
import { Adminizer } from "./Adminizer";
|
|
4
4
|
import { pathToFileURL } from "url";
|
|
5
5
|
class PolicyManager {
|
|
6
6
|
_adminizer;
|
|
@@ -9,7 +9,7 @@ class PolicyManager {
|
|
|
9
9
|
}
|
|
10
10
|
async loadPolicies() {
|
|
11
11
|
try {
|
|
12
|
-
const policiesDirPath = path.join(import.meta.dirname, "
|
|
12
|
+
const policiesDirPath = path.join(import.meta.dirname, "../policies");
|
|
13
13
|
const policiesDir = fs.readdirSync(policiesDirPath);
|
|
14
14
|
for (const policyFile of policiesDir) {
|
|
15
15
|
if (path.extname(policyFile).toLowerCase() === ".js") {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractCatalog, ActionHandler, Item } from "./AbstractCatalog";
|
|
2
|
-
import { NavigationConfig } from "
|
|
3
|
-
import { Adminizer } from "
|
|
2
|
+
import { NavigationConfig } from "../../interfaces/adminpanelConfig";
|
|
3
|
+
import { Adminizer } from "../Adminizer";
|
|
4
4
|
export interface NavItem extends Item {
|
|
5
5
|
urlPath?: string;
|
|
6
6
|
modelId?: string | number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractControls, ControlType, Config, Path } from "../AbstractControls";
|
|
2
|
-
import { Adminizer } from "
|
|
2
|
+
import { Adminizer } from "../../Adminizer";
|
|
3
3
|
export declare class MonacoEditor extends AbstractControls {
|
|
4
4
|
readonly config: Config;
|
|
5
5
|
readonly name: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractControls, ControlType, Config, Path } from "../AbstractControls";
|
|
2
|
-
import { Adminizer } from "
|
|
2
|
+
import { Adminizer } from "../../Adminizer";
|
|
3
3
|
export declare class GeoEditor extends AbstractControls {
|
|
4
4
|
readonly config: Config;
|
|
5
5
|
readonly name: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractControls, ControlType, Path, Config } from "../AbstractControls";
|
|
2
2
|
import { EditorOptions } from "@toast-ui/editor/types/editor";
|
|
3
|
-
import { Adminizer } from "
|
|
3
|
+
import { Adminizer } from "../../Adminizer";
|
|
4
4
|
export declare class JsonEditor extends AbstractControls {
|
|
5
5
|
readonly config: Partial<EditorOptions>;
|
|
6
6
|
readonly name: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractControls, ControlType, Path, Config } from "../AbstractControls";
|
|
2
2
|
import { EditorOptions } from "@toast-ui/editor/types/editor";
|
|
3
|
-
import { Adminizer } from "
|
|
3
|
+
import { Adminizer } from "../../Adminizer";
|
|
4
4
|
export declare class ToastUiEditor extends AbstractControls {
|
|
5
5
|
readonly config: Partial<EditorOptions>;
|
|
6
6
|
readonly name: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractControls, ControlType, Config, Path } from "../AbstractControls";
|
|
2
|
-
import { Adminizer } from "
|
|
2
|
+
import { Adminizer } from "../../Adminizer";
|
|
3
3
|
export declare class Handsontable extends AbstractControls {
|
|
4
4
|
readonly config: Config;
|
|
5
5
|
readonly name: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AbstractControls, ControlType, Config, Path } from "../AbstractControls";
|
|
2
|
-
import { Adminizer } from "
|
|
2
|
+
import { Adminizer } from "../../Adminizer";
|
|
3
3
|
export declare class CKeditor extends AbstractControls {
|
|
4
4
|
readonly name: string;
|
|
5
5
|
readonly type: ControlType;
|
|
@@ -46,6 +46,18 @@ export declare abstract class AbstractModel<T> {
|
|
|
46
46
|
protected abstract _destroyOne(criteria: Partial<T>): Promise<T | null>;
|
|
47
47
|
protected abstract _destroy(criteria: Partial<T>): Promise<T[]>;
|
|
48
48
|
protected abstract _count(criteria: Partial<T> | undefined): Promise<number>;
|
|
49
|
+
/**
|
|
50
|
+
* Generate diff between old and new records
|
|
51
|
+
*/
|
|
52
|
+
private generateDiff;
|
|
53
|
+
/**
|
|
54
|
+
* Generate delete diff (record vs empty object)
|
|
55
|
+
*/
|
|
56
|
+
private generateDeleteDiff;
|
|
57
|
+
/**
|
|
58
|
+
* Log system event with diff
|
|
59
|
+
*/
|
|
60
|
+
private logSystemEvent;
|
|
49
61
|
create(data: T, dataAccessor: DataAccessor): Promise<Partial<T>>;
|
|
50
62
|
findOne(criteria: Partial<T>, dataAccessor: DataAccessor): Promise<Partial<T> | null>;
|
|
51
63
|
find(criteria: Partial<T>, dataAccessor: DataAccessor): Promise<Partial<T>[]>;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { formatChanges, sanitizeForDiff } from "../../helpers/diffHelpers";
|
|
2
|
+
import { diff } from "deep-object-diff";
|
|
3
|
+
export class AbstractModel {
|
|
4
|
+
modelname;
|
|
5
|
+
attributes;
|
|
6
|
+
primaryKey;
|
|
7
|
+
identity;
|
|
8
|
+
constructor(modelname, attributes, primaryKey, identity) {
|
|
9
|
+
this.modelname = modelname;
|
|
10
|
+
this.attributes = attributes;
|
|
11
|
+
this.primaryKey = primaryKey;
|
|
12
|
+
this.identity = identity;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Generate diff between old and new records
|
|
16
|
+
*/
|
|
17
|
+
generateDiff(oldRecord, newRecord) {
|
|
18
|
+
const cleanOldRecord = sanitizeForDiff(oldRecord);
|
|
19
|
+
const cleanNewRecord = sanitizeForDiff(newRecord);
|
|
20
|
+
const changesDiff = diff(cleanOldRecord, cleanNewRecord);
|
|
21
|
+
const formattedChanges = formatChanges(changesDiff, cleanOldRecord, cleanNewRecord);
|
|
22
|
+
return {
|
|
23
|
+
changesDiff,
|
|
24
|
+
formattedChanges,
|
|
25
|
+
cleanOldRecord,
|
|
26
|
+
cleanNewRecord
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Generate delete diff (record vs empty object)
|
|
31
|
+
*/
|
|
32
|
+
generateDeleteDiff(record) {
|
|
33
|
+
const cleanRecord = sanitizeForDiff(record);
|
|
34
|
+
const changesDiff = diff(cleanRecord, {});
|
|
35
|
+
const formattedChanges = formatChanges(changesDiff, cleanRecord, {});
|
|
36
|
+
return {
|
|
37
|
+
changesDiff,
|
|
38
|
+
formattedChanges,
|
|
39
|
+
cleanRecord
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Log system event with diff
|
|
44
|
+
*/
|
|
45
|
+
async logSystemEvent(dataAccessor, eventType, message, oldRecord, newRecord) {
|
|
46
|
+
let formattedChanges = [];
|
|
47
|
+
let summary = '';
|
|
48
|
+
switch (eventType) {
|
|
49
|
+
case 'Created':
|
|
50
|
+
const cleanNewRecord = sanitizeForDiff(newRecord);
|
|
51
|
+
formattedChanges = formatChanges({}, {}, cleanNewRecord, 'add');
|
|
52
|
+
summary = `Created ${formattedChanges.length} fields`;
|
|
53
|
+
break;
|
|
54
|
+
case 'Updated':
|
|
55
|
+
const { formattedChanges: updateChanges } = this.generateDiff(oldRecord, newRecord);
|
|
56
|
+
formattedChanges = updateChanges;
|
|
57
|
+
summary = `Changes ${formattedChanges.length} fields`;
|
|
58
|
+
break;
|
|
59
|
+
case 'Deleted':
|
|
60
|
+
const { formattedChanges: deleteChanges } = this.generateDeleteDiff(oldRecord);
|
|
61
|
+
formattedChanges = deleteChanges;
|
|
62
|
+
summary = `Deleted ${formattedChanges.length} fields`;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
// log system event notification
|
|
66
|
+
await dataAccessor.adminizer.logSystemEvent(eventType, message, {
|
|
67
|
+
changes: formattedChanges,
|
|
68
|
+
summary
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
async create(data, dataAccessor) {
|
|
72
|
+
let _data = await dataAccessor.setUserRelationAccess(dataAccessor.process(data));
|
|
73
|
+
let record = await this._create(_data);
|
|
74
|
+
// Log creation event
|
|
75
|
+
await this.logSystemEvent(dataAccessor, 'Created',
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
`user ${dataAccessor.user.login} create ${dataAccessor.entity.name} ${record[this.primaryKey]}`, {}, _data);
|
|
78
|
+
return dataAccessor.process(record);
|
|
79
|
+
}
|
|
80
|
+
async findOne(criteria, dataAccessor) {
|
|
81
|
+
criteria = await dataAccessor.sanitizeUserRelationAccess(criteria);
|
|
82
|
+
let record = await this._findOne(criteria);
|
|
83
|
+
return record ? dataAccessor.process(record) : null;
|
|
84
|
+
}
|
|
85
|
+
async find(criteria, dataAccessor) {
|
|
86
|
+
criteria = await dataAccessor.sanitizeUserRelationAccess(criteria);
|
|
87
|
+
let records = await this._find(criteria);
|
|
88
|
+
return records.map(record => dataAccessor.process(record));
|
|
89
|
+
}
|
|
90
|
+
async updateOne(criteria, data, dataAccessor) {
|
|
91
|
+
let _data = dataAccessor.process(data);
|
|
92
|
+
// Get the old record first for diff
|
|
93
|
+
criteria = await dataAccessor.sanitizeUserRelationAccess(criteria);
|
|
94
|
+
const oldRecord = await this._findOne(criteria);
|
|
95
|
+
if (!oldRecord) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
let record = await this._updateOne(criteria, _data);
|
|
99
|
+
if (!record) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
// Log update event
|
|
103
|
+
await this.logSystemEvent(dataAccessor, 'Updated',
|
|
104
|
+
// @ts-ignore
|
|
105
|
+
`user ${dataAccessor.user.login} update ${dataAccessor.entity.name} ${record[this.primaryKey]}`, oldRecord, record);
|
|
106
|
+
return dataAccessor.process(record);
|
|
107
|
+
}
|
|
108
|
+
async update(criteria, data, dataAccessor) {
|
|
109
|
+
let _data = dataAccessor.process(data);
|
|
110
|
+
criteria = await dataAccessor.sanitizeUserRelationAccess(criteria);
|
|
111
|
+
// Get old records automatically
|
|
112
|
+
const oldRecords = await this._find(criteria);
|
|
113
|
+
let records = await this._update(criteria, _data);
|
|
114
|
+
// Log update events for each record
|
|
115
|
+
for (let i = 0; i < records.length; i++) {
|
|
116
|
+
const record = records[i];
|
|
117
|
+
const oldRecord = oldRecords[i];
|
|
118
|
+
if (oldRecord) {
|
|
119
|
+
await this.logSystemEvent(dataAccessor, 'Updated',
|
|
120
|
+
// @ts-ignore
|
|
121
|
+
`user ${dataAccessor.user.login} update ${dataAccessor.entity.name} ${record[this.primaryKey]}`, oldRecord, record);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return records.map(record => dataAccessor.process(record));
|
|
125
|
+
}
|
|
126
|
+
async destroyOne(criteria, dataAccessor) {
|
|
127
|
+
// Get the record first for diff
|
|
128
|
+
criteria = await dataAccessor.sanitizeUserRelationAccess(criteria);
|
|
129
|
+
const oldRecord = await this._findOne(criteria);
|
|
130
|
+
if (!oldRecord) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
let record = await this._destroyOne(criteria);
|
|
134
|
+
if (!record) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
// Log delete event
|
|
138
|
+
await this.logSystemEvent(dataAccessor, 'Deleted',
|
|
139
|
+
//@ts-ignore
|
|
140
|
+
`user ${dataAccessor.user.login} delete ${dataAccessor.entity.name} ${record[this.primaryKey]}`, oldRecord, {});
|
|
141
|
+
return dataAccessor.process(record);
|
|
142
|
+
}
|
|
143
|
+
async destroy(criteria, dataAccessor) {
|
|
144
|
+
// Get records first for diff
|
|
145
|
+
criteria = await dataAccessor.sanitizeUserRelationAccess(criteria);
|
|
146
|
+
const oldRecords = await this._find(criteria);
|
|
147
|
+
let records = await this._destroy(criteria);
|
|
148
|
+
// Log delete events for each record
|
|
149
|
+
for (let i = 0; i < records.length; i++) {
|
|
150
|
+
const record = records[i];
|
|
151
|
+
const oldRecord = oldRecords[i];
|
|
152
|
+
if (oldRecord) {
|
|
153
|
+
await this.logSystemEvent(dataAccessor, 'Deleted',
|
|
154
|
+
//@ts-ignore
|
|
155
|
+
`user ${dataAccessor.user.login} delete ${dataAccessor.entity.name} ${record[this.primaryKey]}`, oldRecord, {});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return records.map(record => dataAccessor.process(record));
|
|
159
|
+
}
|
|
160
|
+
async count(criteria, dataAccessor) {
|
|
161
|
+
criteria = await dataAccessor.sanitizeUserRelationAccess(criteria);
|
|
162
|
+
return this._count(criteria);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
export class AbstractAdapter {
|
|
166
|
+
orm;
|
|
167
|
+
ormType;
|
|
168
|
+
constructor(type, orm) {
|
|
169
|
+
this.ormType = type;
|
|
170
|
+
this.orm = orm;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* This method must ensure system models registration and throw an error in case of errors. We force all adapters to realize it
|
|
174
|
+
*/
|
|
175
|
+
static registerSystemModels(orm) {
|
|
176
|
+
throw new Error("Function 'registerSystemModels' must be implemented by subclass");
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -22,15 +22,13 @@ export declare class SequelizeModel<T> extends AbstractModel<T> {
|
|
|
22
22
|
protected _count(criteria?: Partial<T>): Promise<number>;
|
|
23
23
|
private _buildIncludes;
|
|
24
24
|
}
|
|
25
|
-
/** SequelizeAdapter — адаптер, заменяющий WaterlineAdapter */
|
|
26
25
|
export declare class SequelizeAdapter extends AbstractAdapter {
|
|
27
|
-
|
|
26
|
+
sequelize: Sequelize;
|
|
28
27
|
Model: typeof SequelizeModel;
|
|
29
|
-
alter: boolean;
|
|
30
28
|
constructor(sequelize: Sequelize);
|
|
31
29
|
get models(): Record<string, any>;
|
|
32
30
|
getModel(modelName: string): any;
|
|
33
31
|
getAttributes(modelName: string): any;
|
|
34
|
-
/**Registration of system models*/
|
|
32
|
+
/** Registration of system models */
|
|
35
33
|
static registerSystemModels(sequelize: Sequelize, alter?: boolean): Promise<void>;
|
|
36
34
|
}
|