adminizer 4.1.0-build.3 → 4.1.0-build.4

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.
@@ -26,6 +26,7 @@ export declare class Adminizer {
26
26
  controlsHandler: ControlsHandler;
27
27
  static logger: winston.Logger;
28
28
  constructor(ormAdapters: AbstractAdapter[]);
29
+ getMiddleware(): (req: any, res: any) => void;
29
30
  /**
30
31
  * Vite middleware
31
32
  * @protected
package/lib/Adminizer.js CHANGED
@@ -58,6 +58,21 @@ export class Adminizer {
58
58
  this._emitter = new EventEmitter();
59
59
  this.ormAdapters = ormAdapters;
60
60
  }
61
+ getMiddleware() {
62
+ return (req, res) => {
63
+ this.app(req, res, (err) => {
64
+ if (err) {
65
+ console.log("Error in Adminizer", err);
66
+ res.writeHead(500, { 'Content-Type': 'text/plain' });
67
+ res.end('Internal Server Error');
68
+ }
69
+ else {
70
+ res.writeHead(404, { 'Content-Type': 'text/plain' });
71
+ res.end('Route Not Found in Adminizer');
72
+ }
73
+ });
74
+ };
75
+ }
61
76
  /**
62
77
  * Vite middleware
63
78
  * @protected
@@ -42,7 +42,7 @@ function resolveType(type) {
42
42
  }
43
43
  /** SequelizeModel — реализация модели, совместимая с AbstractModel */
44
44
  function convertCriteriaToSequelize(criteria) {
45
- console.log("waterline criteria", criteria);
45
+ console.debug("waterline criteria", criteria);
46
46
  const result = {};
47
47
  for (const key in criteria) {
48
48
  const value = criteria[key];
@@ -80,7 +80,7 @@ function convertCriteriaToSequelize(criteria) {
80
80
  return result;
81
81
  }
82
82
  function convertWaterlineCriteriaToSequelizeOptions(criteria) {
83
- console.log("WATERLINE CRITERIA", criteria);
83
+ console.debug("WATERLINE CRITERIA", criteria);
84
84
  const { where = {}, skip, limit, sort } = criteria;
85
85
  const result = {
86
86
  where: convertCriteriaToSequelize(where),
@@ -48,7 +48,6 @@ export class WaterlineModel extends AbstractModel {
48
48
  query = query.limit(options.limit);
49
49
  }
50
50
  let result = await query;
51
- console.log(result, "result");
52
51
  return result;
53
52
  }
54
53
  async _updateOne(criteria, data) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adminizer",
3
3
  "type": "module",
4
- "version": "4.1.0-build.3",
4
+ "version": "4.1.0-build.4",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1",