adminizer 4.0.0-commit.f68c68e → 4.0.0

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.
@@ -128,8 +128,6 @@ export default async function edit(req, res) {
128
128
  }
129
129
  }
130
130
  }
131
- // req.session.messages.adminSuccess.push('Your record was updated !');
132
- // return res.redirect(`${req.adminizer.config.routePrefix}/model/${entity.name}`);
133
131
  req.flash.setFlashMessage('success', 'Your record was updated !');
134
132
  return req.Inertia.redirect(`${req.adminizer.config.routePrefix}/model/${entity.name}`);
135
133
  }
@@ -156,18 +154,14 @@ export default async function edit(req, res) {
156
154
  }
157
155
  }
158
156
  if (req.query.without_layout) {
159
- return res.viewAdmin("./../ejs/partials/content/editPopup.ejs", {
160
- entity: entity,
161
- record: record,
162
- fields: fields
163
- });
157
+ // return res.viewAdmin("./../ejs/partials/content/editPopup.ejs", {
158
+ // entity: entity,
159
+ // record: record,
160
+ // fields: fields
161
+ // });
162
+ return null;
164
163
  }
165
164
  else {
166
- // return res.viewAdmin(null,{
167
- // entity: entity,
168
- // record: record,
169
- // fields: fields
170
- // });
171
165
  const props = inertiaAddHelper(req, entity, fields, record);
172
166
  return req.Inertia.render({
173
167
  component: 'add',
@@ -68,7 +68,6 @@ export default async function editGroup(req, res) {
68
68
  users: usersInThisGroup, tokens: tokensOfThisGroup
69
69
  });
70
70
  Adminizer.log.debug(`Group was updated: `, updatedGroup);
71
- // req.session.messages.adminSuccess.push('Group was updated !');
72
71
  req.flash.setFlashMessage('success', 'Group was updated !');
73
72
  return req.Inertia.redirect(`${req.adminizer.config.routePrefix}/model/groupap`);
74
73
  }
@@ -97,7 +96,6 @@ export default async function editGroup(req, res) {
97
96
  }
98
97
  }
99
98
  // console.log("GROUP", group)
100
- // return res.viewAdmin("editGroup", {entity: entity, group: group, users: users, groupedTokens: groupedTokens});
101
99
  const props = inertiaGroupHelper(entity, req, users, groupedTokens, group);
102
100
  return req.Inertia.render({
103
101
  component: 'add-group',
@@ -72,7 +72,6 @@ export default async function (req, res) {
72
72
  });
73
73
  }
74
74
  Adminizer.log.debug(`User was updated: `, updatedUser);
75
- // req.session.messages.adminSuccess.push('User was updated !');
76
75
  req.flash.setFlashMessage('success', 'User was updated !');
77
76
  return req.Inertia.redirect(`${req.adminizer.config.routePrefix}/model/userap`);
78
77
  }
@@ -100,7 +99,6 @@ export default async function (req, res) {
100
99
  Adminizer.log.error(e);
101
100
  }
102
101
  }
103
- // return res.viewAdmin("editUser", {entity: entity, user: user, groups: groups});
104
102
  const props = inertiaUserHelper(entity, req, groups, user);
105
103
  return req.Inertia.render({
106
104
  component: 'add-user',
@@ -59,7 +59,6 @@ export default async function form(req, res) {
59
59
  Adminizer.log.silly(`'${slug}' property was not found in storage, using source file`);
60
60
  }
61
61
  }
62
- // res.viewAdmin("form", {formData: form, slug: slug});
63
62
  const props = inertiaFormHelper(req, `${req.adminizer.config.routePrefix}/form/${slug}`, form);
64
63
  // console.log(props)
65
64
  return req.Inertia.render({
@@ -58,7 +58,6 @@ export default async function login(req, res) {
58
58
  if (req.method.toUpperCase() === "GET") {
59
59
  // Generate new CAPTCHA job
60
60
  const captchaTask = await powCaptcha.getJob(`login:${req.ip}`);
61
- // return res.viewAdmin("login", {captchaTask: captchaTask});
62
61
  return req.Inertia.render({
63
62
  component: 'login',
64
63
  props: {
@@ -82,8 +81,6 @@ export default async function login(req, res) {
82
81
  async function inertiaAdminMessage(req, message, messageType) {
83
82
  const powCaptcha = new POWCaptcha();
84
83
  const captchaTask = await powCaptcha.getJob(`login:${req.ip}`);
85
- // req.session.messages.adminError.push(message);
86
- // return res.viewAdmin("login", {captchaTask: captchaTask});
87
84
  let errors = {};
88
85
  errors[messageType] = message;
89
86
  return req.Inertia.render({
@@ -6,9 +6,6 @@ export default async function register(req, res) {
6
6
  }
7
7
  if (req.method.toUpperCase() === "POST") {
8
8
  // console.log("req.body", req.body);
9
- // if (!req.body.login || !req.body.fullName || !req.body.password) {
10
- // return res.status(400).send({error: 'Missing required parameters'});
11
- // }
12
9
  for (const key of ["login", "fullName", "password"]) {
13
10
  if (!req.body[key]) {
14
11
  let errors = {};
@@ -69,7 +66,6 @@ export default async function register(req, res) {
69
66
  }
70
67
  }
71
68
  if (req.method.toUpperCase() === "GET") {
72
- // return res.viewAdmin("register");
73
69
  return req.Inertia.render({
74
70
  component: "register",
75
71
  props: inertiaRegisterHelper(req),
@@ -67,15 +67,12 @@ export default async function remove(req, res) {
67
67
  Adminizer.log.error('adminpanel > error', e);
68
68
  }
69
69
  if (destroyedRecord) {
70
- // req.session.messages.adminSuccess.push('Record was removed successfully');
71
70
  req.flash.setFlashMessage('success', 'Record was removed successfully !');
72
71
  }
73
72
  else {
74
- // req.session.messages.adminError.push('Record was not removed');
75
73
  req.flash.setFlashMessage('success', 'Record was not removed');
76
74
  }
77
75
  let referToUrl = referTo ? `${entity.uri}${referTo}` : `${entity.uri}`;
78
76
  return req.Inertia.redirect(`${referToUrl}`);
79
- // res.redirect(`${req.adminizer.config.routePrefix}/${entity.uri}`);
80
77
  }
81
78
  ;
@@ -36,11 +36,6 @@ export default async function view(req, res) {
36
36
  Adminizer.log.error(e);
37
37
  return res.status(500).send({ error: 'Internal Server Error' });
38
38
  }
39
- // res.viewAdmin(null, {
40
- // entity: entity,
41
- // record: record,
42
- // fields: fields
43
- // });
44
39
  switch (entity.config.model) {
45
40
  case 'userap':
46
41
  let groups;
package/lib/Adminizer.js CHANGED
@@ -6,7 +6,6 @@ import EventEmitter from 'events';
6
6
  import chalk from 'chalk';
7
7
  import PolicyManager from "./v4/PolicyManager";
8
8
  import Router from "./../system/Router";
9
- import { ViewsHelper } from "../helpers/viewsHelper";
10
9
  import bindAssets from "../system/bindAssets";
11
10
  import bindDev from "../system/bindDev";
12
11
  import bindDashboardWidgets from "../system/bindDashboardWidgets";
@@ -99,7 +98,6 @@ export class Adminizer {
99
98
  this.modelHandler = new ModelHandler();
100
99
  await bindModels(this);
101
100
  await bindForms(this);
102
- this.config.templateRootPath = ViewsHelper.BASE_VIEWS_PATH;
103
101
  this.config.rootPath = path.resolve(import.meta.dirname + "/..");
104
102
  this.policyManager = new PolicyManager(this);
105
103
  await this.policyManager.loadPolicies();
@@ -108,10 +106,9 @@ export class Adminizer {
108
106
  this.menuHelper = new MenuHelper(this.config);
109
107
  this.widgetHandler = new WidgetHandler(this);
110
108
  bindExpressUtils(this.app);
111
- // bindResFunctions(this);
112
109
  bindReqFunctions(this);
113
110
  // add install stepper policy to check unfilled settings
114
- // bindInstallStepper(this);
111
+ // bindInstallStepper(this); // TODO It is necessary to provide an opportunity to be inserted by an intermediary after authorization, but before the admin panel, in order to block the user from managing the Installstepper's admin panel.
115
112
  // Bind assets
116
113
  bindAssets(this.app, this.config.routePrefix);
117
114
  if ((process.env.DEV && process.env.NODE_ENV !== 'production') || process.env.ADMINPANEL_FORCE_BIND_DEV === "TRUE") {
@@ -121,7 +118,6 @@ export class Adminizer {
121
118
  // bindNavigation(this);
122
119
  // bindMediaManager(this);
123
120
  await bindAccessRights(this);
124
- // bindViewsLocals(this); // must be after setting all helpers that binds in here
125
121
  if (I18n.appendLocale) {
126
122
  bindTranslations(this);
127
123
  }
@@ -6,5 +6,5 @@ export declare class ControlsHandler {
6
6
  getByType<T extends ControlType>(type: T): AbstractControls[];
7
7
  remove(type: ControlType, name: string): boolean;
8
8
  getAll(): Record<ControlType, AbstractControls[]>;
9
- collectAndGenerateStyleLinks(routePrefix: string): string[];
9
+ collectAndGenerateStyleLinks(): string[];
10
10
  }
@@ -33,7 +33,7 @@ export class ControlsHandler {
33
33
  Array.from(group.values())
34
34
  ]));
35
35
  }
36
- collectAndGenerateStyleLinks(routePrefix) {
36
+ collectAndGenerateStyleLinks() {
37
37
  const stylesheets = [];
38
38
  const allControls = this.getAll();
39
39
  Object.values(allControls).forEach(controls => {
@@ -152,48 +152,6 @@ export class NodeTable {
152
152
  callback(error, null);
153
153
  }
154
154
  }
155
- // mapData(data: { [key: string]: any }): object[] {
156
- // let out: object[] = [];
157
- // data.forEach((elem: any) => {
158
- // let row: any = [elem[this.model.primaryKey ?? 'id']];
159
- // Object.keys(this.fields).forEach((key: string) => {
160
- // let fieldConfigConfig = this.fields[key].config as BaseFieldConfig;
161
- // if (fieldConfigConfig.displayModifier) {
162
- // row.push(fieldConfigConfig.displayModifier(elem[key]));
163
- // } else if (this.fields[key].model && this.fields[key].model.model) {
164
- // // Обработка связей типа "belongsTo"
165
- // if (!elem[key]) {
166
- // row.push(null);
167
- // } else {
168
- // row.push(elem[key][fieldConfigConfig.displayField]);
169
- // }
170
- // } else if (this.fields[key].model.type === "association-many" || this.fields[key].model.type === "association") {
171
- // if (!elem[key] || elem[key].length === 0) {
172
- // row.push(null);
173
- // } else {
174
- // let displayValues: string[] = [];
175
- // elem[key].forEach((item: any) => {
176
- // if (item[fieldConfigConfig.displayField]) {
177
- // displayValues.push(item[fieldConfigConfig.displayField]);
178
- // } else {
179
- // displayValues.push(item[fieldConfigConfig.identifierField]);
180
- // }
181
- // });
182
- // row.push(displayValues.join(', '));
183
- // }
184
- //
185
- // } else if (this.fields[key].model.type === "json") {
186
- // let str = JSON.stringify(elem[key]);
187
- // row.push(str === "{}" ? "" : str);
188
- // } else {
189
- // row.push(elem[key]);
190
- // }
191
- // });
192
- // out.push(row);
193
- // });
194
- //
195
- // return out;
196
- // }
197
155
  mapData(data) {
198
156
  let out = [];
199
157
  data.forEach((elem) => {
@@ -23,7 +23,7 @@ const inertiaExpressAdapter = function ({ version, html, flashMessages, enableRe
23
23
  const csrfHeader = req.headers[csrf.headerName || 'x-xsrf-token'];
24
24
  // console.log('headers:', req.headers['x-xsrf-token']);
25
25
  if (!csrfCookie || !csrfHeader || csrfCookie !== csrfHeader) {
26
- res.status(403).json({ message: 'Invalid CSRF token' });
26
+ res.status(403).send({ message: 'Invalid CSRF token' });
27
27
  return;
28
28
  }
29
29
  }
package/package.json CHANGED
@@ -1,122 +1,122 @@
1
1
  {
2
- "name": "adminizer",
3
- "type": "module",
4
- "version": "4.0.0-commit.f68c68e",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
8
- "start": "tsx --tsconfig ./waterlineFixture/tsconfig.json ./waterlineFixture/index.ts",
9
- "dev": "cross-env VITE_ENV=dev tsx watch --tsconfig ./waterlineFixture/tsconfig.json ./waterlineFixture/index.ts",
10
- "build:assets": "vite build",
11
- "compile:backend": "tsc -p src/tsconfig.json",
12
- "watch:backend": "tsc -w -p src/tsconfig.json",
13
- "copy:backend": "node copy-backend.js",
14
- "build:backend": "npm run copy:backend && npm run compile:backend",
15
- "build": "npm run copy:backend && npm run compile:backend && npm run build:assets",
16
- "build:module": "vite build --config modules/test/vite.config.module.ts",
17
- "build:react-quill": "vite build --config modules/controls/wysiwyg/vite.config.react-quill.ts",
18
- "copy:modules": "node copy-modules.js",
19
- "build:assets:modules": "npm run build:assets && npm run copy:modules",
20
- "start:seed": "cross-env SEED_DATA=true tsx --tsconfig ./waterlineFixture/tsconfig.json ./waterlineFixture/index.ts",
21
- "demo:build": "npm run copy:backend && npm run compile:backend && npm run build:assets && npm run copy:modules",
22
- "demo": "npm run start:seed"
23
- },
24
- "keywords": [],
25
- "author": "",
26
- "license": "ISC",
27
- "description": "",
28
- "dependencies": {
29
- "@radix-ui/react-menubar": "^1.1.12",
30
- "body-parser": "^1.20.3",
31
- "chalk": "^5.4.1",
32
- "cmdk": "^1.1.1",
33
- "cookie-parser": "^1.4.7",
34
- "cors": "^2.8.5",
35
- "crypto-puzzle": "^5.0.2",
36
- "date-fns": "^3.6.0",
37
- "ejs": "^3.1.10",
38
- "express": "^4.21.2",
39
- "express-session": "^1.18.1",
40
- "ky": "^1.8.0",
41
- "multer": "^1.4.5-lts.1",
42
- "next-themes": "^0.4.6",
43
- "password-hash": "^1.2.2",
44
- "sharp": "^0.33.5",
45
- "typeorm": "^0.3.20",
46
- "uuid": "^11.0.5",
47
- "winston": "^3.17.0"
48
- },
49
- "devDependencies": {
50
- "@ckeditor/ckeditor5-react": "^9.5.0",
51
- "@faker-js/faker": "^9.7.0",
52
- "@handsontable/react": "^15.2.0",
53
- "@inertiajs/react": "^2.0.0",
54
- "@monaco-editor/react": "^4.7.0",
55
- "@radix-ui/react-avatar": "^1.1.3",
56
- "@radix-ui/react-checkbox": "^1.1.4",
57
- "@radix-ui/react-collapsible": "^1.1.3",
58
- "@radix-ui/react-dialog": "^1.1.7",
59
- "@radix-ui/react-dropdown-menu": "^2.1.6",
60
- "@radix-ui/react-label": "^2.1.2",
61
- "@radix-ui/react-popover": "^1.1.7",
62
- "@radix-ui/react-select": "^2.1.6",
63
- "@radix-ui/react-separator": "^1.1.3",
64
- "@radix-ui/react-slider": "^1.2.3",
65
- "@radix-ui/react-slot": "^1.2.0",
66
- "@radix-ui/react-tooltip": "^1.1.8",
67
- "@tailwindcss/vite": "^4.0.15",
68
- "@tanstack/react-table": "^8.21.2",
69
- "@toast-ui/react-editor": "^3.2.3",
70
- "@types/cookie-parser": "^1.4.8",
71
- "@types/cors": "^2.8.17",
72
- "@types/express": "^5.0.0",
73
- "@types/express-session": "^1.18.1",
74
- "@types/he": "^1.2.3",
75
- "@types/json-schema": "^7.0.15",
76
- "@types/leaflet": "^1.9.17",
77
- "@types/lodash-es": "^4.17.12",
78
- "@types/multer": "^1.4.12",
79
- "@types/node": "^22.10.5",
80
- "@types/password-hash": "^1.2.24",
81
- "@types/react": "^19.0.3",
82
- "@types/react-dom": "^19.0.2",
83
- "@types/sprintf-js": "^1.1.4",
84
- "@types/uuid": "^10.0.0",
85
- "@types/waterline": "^0.13.9",
86
- "@vitejs/plugin-react": "^4.3.4",
87
- "babel-plugin-react-compiler": "^19.0.0-beta-e993439-20250405",
88
- "ckeditor5": "^45.0.0",
89
- "class-variance-authority": "^0.7.1",
90
- "clsx": "^2.1.1",
91
- "cross-env": "^7.0.3",
92
- "handsontable": "^15.2.0",
93
- "json-schema": "^0.4.0",
94
- "leaflet": "^1.9.4",
95
- "leaflet-draw": "^1.0.4",
96
- "lodash-es": "^4.17.21",
97
- "lucide-react": "^0.485.0",
98
- "material-icons": "^1.13.14",
99
- "react": "^19.0.0",
100
- "react-day-picker": "^8.10.1",
101
- "react-dom": "^19.0.0",
102
- "react-intersection-observer": "^9.16.0",
103
- "react-leaflet": "^5.0.0",
104
- "react-quill-new": "^3.4.6",
105
- "react-simple-wysiwyg": "^3.2.2",
106
- "sails-disk": "^2.1.2",
107
- "sails-postgresql": "^5.0.1",
108
- "shelljs": "^0.9.2",
109
- "sonner": "^2.0.3",
110
- "sprintf-js": "^1.1.3",
111
- "tailwind-merge": "^3.0.2",
112
- "tailwindcss": "^4.0.15",
113
- "tsx": "^4.19.3",
114
- "tw-animate-css": "^1.2.5",
115
- "typescript": "^5.7.2",
116
- "vanilla-jsoneditor": "^3.1.1",
117
- "vite": "^6.1.0",
118
- "vite-plugin-externals": "^0.6.2",
119
- "vite-plugin-full-reload": "^1.2.0",
120
- "waterline": "^0.15.2"
121
- }
2
+ "name": "adminizer",
3
+ "type": "module",
4
+ "version": "4.0.0",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "start": "tsx --tsconfig ./waterlineFixture/tsconfig.json ./waterlineFixture/index.ts",
9
+ "dev": "cross-env VITE_ENV=dev tsx watch --tsconfig ./waterlineFixture/tsconfig.json ./waterlineFixture/index.ts",
10
+ "build:assets": "vite build",
11
+ "compile:backend": "tsc -p src/tsconfig.json",
12
+ "watch:backend": "tsc -w -p src/tsconfig.json",
13
+ "copy:backend": "node copy-backend.js",
14
+ "build:backend": "npm run copy:backend && npm run compile:backend",
15
+ "build": "npm run copy:backend && npm run compile:backend && npm run build:assets",
16
+ "build:module": "vite build --config modules/test/vite.config.module.ts",
17
+ "build:react-quill": "vite build --config modules/controls/wysiwyg/vite.config.react-quill.ts",
18
+ "copy:modules": "node copy-modules.js",
19
+ "build:assets:modules": "npm run build:assets && npm run copy:modules",
20
+ "start:seed": "cross-env SEED_DATA=true tsx --tsconfig ./waterlineFixture/tsconfig.json ./waterlineFixture/index.ts",
21
+ "demo:build": "npm run copy:backend && npm run compile:backend && npm run build:assets && npm run copy:modules",
22
+ "demo": "npm run start:seed"
23
+ },
24
+ "keywords": [],
25
+ "author": "",
26
+ "license": "MIT",
27
+ "description": "",
28
+ "dependencies": {
29
+ "@radix-ui/react-menubar": "^1.1.12",
30
+ "body-parser": "^1.20.3",
31
+ "chalk": "^5.4.1",
32
+ "cmdk": "^1.1.1",
33
+ "cookie-parser": "^1.4.7",
34
+ "cors": "^2.8.5",
35
+ "crypto-puzzle": "^5.0.2",
36
+ "date-fns": "^3.6.0",
37
+ "ejs": "^3.1.10",
38
+ "express": "^4.21.2",
39
+ "express-session": "^1.18.1",
40
+ "ky": "^1.8.0",
41
+ "multer": "^1.4.5-lts.1",
42
+ "next-themes": "^0.4.6",
43
+ "password-hash": "^1.2.2",
44
+ "sharp": "^0.33.5",
45
+ "typeorm": "^0.3.20",
46
+ "uuid": "^11.0.5",
47
+ "winston": "^3.17.0"
48
+ },
49
+ "devDependencies": {
50
+ "@ckeditor/ckeditor5-react": "^9.5.0",
51
+ "@faker-js/faker": "^9.7.0",
52
+ "@handsontable/react": "^15.2.0",
53
+ "@inertiajs/react": "^2.0.0",
54
+ "@monaco-editor/react": "^4.7.0",
55
+ "@radix-ui/react-avatar": "^1.1.3",
56
+ "@radix-ui/react-checkbox": "^1.1.4",
57
+ "@radix-ui/react-collapsible": "^1.1.3",
58
+ "@radix-ui/react-dialog": "^1.1.7",
59
+ "@radix-ui/react-dropdown-menu": "^2.1.6",
60
+ "@radix-ui/react-label": "^2.1.2",
61
+ "@radix-ui/react-popover": "^1.1.7",
62
+ "@radix-ui/react-select": "^2.1.6",
63
+ "@radix-ui/react-separator": "^1.1.3",
64
+ "@radix-ui/react-slider": "^1.2.3",
65
+ "@radix-ui/react-slot": "^1.2.0",
66
+ "@radix-ui/react-tooltip": "^1.1.8",
67
+ "@tailwindcss/vite": "^4.0.15",
68
+ "@tanstack/react-table": "^8.21.2",
69
+ "@toast-ui/react-editor": "^3.2.3",
70
+ "@types/cookie-parser": "^1.4.8",
71
+ "@types/cors": "^2.8.17",
72
+ "@types/express": "^5.0.0",
73
+ "@types/express-session": "^1.18.1",
74
+ "@types/he": "^1.2.3",
75
+ "@types/json-schema": "^7.0.15",
76
+ "@types/leaflet": "^1.9.17",
77
+ "@types/lodash-es": "^4.17.12",
78
+ "@types/multer": "^1.4.12",
79
+ "@types/node": "^22.10.5",
80
+ "@types/password-hash": "^1.2.24",
81
+ "@types/react": "^19.0.3",
82
+ "@types/react-dom": "^19.0.2",
83
+ "@types/sprintf-js": "^1.1.4",
84
+ "@types/uuid": "^10.0.0",
85
+ "@types/waterline": "^0.13.9",
86
+ "@vitejs/plugin-react": "^4.3.4",
87
+ "babel-plugin-react-compiler": "^19.0.0-beta-e993439-20250405",
88
+ "ckeditor5": "^45.0.0",
89
+ "class-variance-authority": "^0.7.1",
90
+ "clsx": "^2.1.1",
91
+ "cross-env": "^7.0.3",
92
+ "handsontable": "^15.2.0",
93
+ "json-schema": "^0.4.0",
94
+ "leaflet": "^1.9.4",
95
+ "leaflet-draw": "^1.0.4",
96
+ "lodash-es": "^4.17.21",
97
+ "lucide-react": "^0.485.0",
98
+ "material-icons": "^1.13.14",
99
+ "react": "^19.0.0",
100
+ "react-day-picker": "^8.10.1",
101
+ "react-dom": "^19.0.0",
102
+ "react-intersection-observer": "^9.16.0",
103
+ "react-leaflet": "^5.0.0",
104
+ "react-quill-new": "^3.4.6",
105
+ "react-simple-wysiwyg": "^3.2.2",
106
+ "sails-disk": "^2.1.2",
107
+ "sails-postgresql": "^5.0.1",
108
+ "shelljs": "^0.9.2",
109
+ "sonner": "^2.0.3",
110
+ "sprintf-js": "^1.1.3",
111
+ "tailwind-merge": "^3.0.2",
112
+ "tailwindcss": "^4.0.15",
113
+ "tsx": "^4.19.3",
114
+ "tw-animate-css": "^1.2.5",
115
+ "typescript": "^5.7.2",
116
+ "vanilla-jsoneditor": "^3.1.1",
117
+ "vite": "^6.1.0",
118
+ "vite-plugin-externals": "^0.6.2",
119
+ "vite-plugin-full-reload": "^1.2.0",
120
+ "waterline": "^0.15.2"
121
+ }
122
122
  }
package/system/Router.js CHANGED
@@ -3,7 +3,6 @@ import _processInstallFinalize from "../controllers/processInstallFinalize";
3
3
  import _dashboard from "../controllers/dashboard";
4
4
  import _welcome from "../controllers/welcome";
5
5
  import _list from "../controllers/list";
6
- import _listJson from "../controllers/listJson";
7
6
  import _edit from "../controllers/edit";
8
7
  import _add from "../controllers/add";
9
8
  import _view from "../controllers/view";
@@ -143,7 +142,6 @@ export default class Router {
143
142
  * View record details
144
143
  */
145
144
  adminizer.app.all(baseRoute + "/view/:id", adminizer.policyManager.bindPolicies(policies, _view));
146
- adminizer.app.all(baseRoute + "/json", adminizer.policyManager.bindPolicies(policies, _listJson));
147
145
  /**
148
146
  * Remove record
149
147
  */
@@ -50,7 +50,7 @@ export function bindInertia(adminizer) {
50
50
  scripts.push(`<script type="module" src="${href}"></script>`);
51
51
  }
52
52
  // Load modules CSS
53
- const modulesCss = adminizer.controlsHandler.collectAndGenerateStyleLinks(adminizer.config.routePrefix);
53
+ const modulesCss = adminizer.controlsHandler.collectAndGenerateStyleLinks();
54
54
  modulesCss.forEach(cssPath => {
55
55
  preloadLinks.push(`<link rel="preload" href="${cssPath}" as="style">`);
56
56
  stylesheets.push(`<link rel="stylesheet" href="${cssPath}">`);
@@ -1 +0,0 @@
1
- export default function listJson(req: ReqType, res: ResType): Promise<void | ResType>;
@@ -1,35 +0,0 @@
1
- import { ControllerHelper } from "../helpers/controllerHelper";
2
- import { NodeTable } from "../lib/datatable/NodeTable";
3
- import { DataAccessor } from "../lib/v4/DataAccessor";
4
- import { Adminizer } from "../lib/Adminizer";
5
- export default async function listJson(req, res) {
6
- try {
7
- let entity = ControllerHelper.findEntityObject(req);
8
- if (!entity.model) {
9
- return res.status(404).send({ error: 'Not Found' });
10
- }
11
- if (req.adminizer.config.auth) {
12
- if (!req.session.UserAP) {
13
- return res.redirect(`${req.adminizer.config.routePrefix}/model/userap/login`);
14
- }
15
- else if (!req.adminizer.accessRightsHelper.hasPermission(`read-${entity.name}-model`, req.session.UserAP)) {
16
- return res.sendStatus(403);
17
- }
18
- }
19
- let dataAccessor = new DataAccessor(req, entity, "list");
20
- let fields = dataAccessor.getFieldsConfig();
21
- const nodeTable = new NodeTable(req.body, entity.model, fields);
22
- // @ts-ignore
23
- await nodeTable.output((err, data) => {
24
- if (err) {
25
- Adminizer.log.error(err);
26
- }
27
- // Directly send this data as output to Datatable
28
- return res.send(data);
29
- }, dataAccessor);
30
- }
31
- catch (error) {
32
- Adminizer.log.error(error);
33
- }
34
- }
35
- ;
@@ -1,44 +0,0 @@
1
- import { Field } from "./fieldsHelper";
2
- import { ModelAnyField } from "../lib/v4/model/AbstractModel";
3
- export declare class ViewsHelper {
4
- /**
5
- * Base path for all views.
6
- */
7
- static BASE_VIEWS_PATH: string;
8
- /**
9
- * Will generate path to view file
10
- *
11
- * @param {string} view
12
- * @returns {string}
13
- */
14
- static getViewPath(view: string): string;
15
- /**
16
- *
17
- * @param {IncomingMessage} req
18
- * @param {string} key Types: adminError|adminSuccess
19
- */
20
- static hasMessages(req: ReqType, key: "adminError" | "adminSuccess"): string[];
21
- /**
22
- * Get needed field value from dat provided.
23
- *
24
- * @param {string} key
25
- * @param {object} field
26
- * @param {Array} data
27
- */
28
- static getFieldValue(key: string, field: Field, data: any): ModelAnyField;
29
- /**
30
- * Check if given option equals value or is in array
31
- *
32
- * @param {string|number} option
33
- * @param {string|number|Array} value
34
- * @returns {boolean}
35
- */
36
- static isOptionSelected(option: string | number | boolean, value: string | number | boolean | (string | number | boolean)[]): boolean;
37
- /**
38
- * Gets field value for view screen
39
- *
40
- * @param {string|number|boolean|object|Array} value
41
- * @param {object} field
42
- */
43
- static getAssociationValue(value: ModelAnyField, field: Field): string;
44
- }