@dnax/core 0.74.3 → 0.74.5
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/app/hono.ts +8 -2
- package/index.ts +3 -0
- package/lib/plugins.ts +7 -0
- package/package.json +1 -1
package/app/hono.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { consola } from "consola";
|
|
|
16
16
|
import { cors } from "hono/cors";
|
|
17
17
|
import { asyncLocalStorage, sessionStorage } from "../lib/asyncLocalStorage";
|
|
18
18
|
import { crypt } from "../lib/crypto";
|
|
19
|
+
import { plugins } from "../lib/plugins";
|
|
19
20
|
import {
|
|
20
21
|
cleanPath,
|
|
21
22
|
ContextError,
|
|
@@ -243,6 +244,7 @@ function HonoInstance(): typeof app {
|
|
|
243
244
|
if (col && action && colAccess) {
|
|
244
245
|
let basicNextAccess = false;
|
|
245
246
|
|
|
247
|
+
// get permission by role
|
|
246
248
|
if (getPermission(session.get()?.role, tenant_id)) {
|
|
247
249
|
basicNextAccess = checkPermission(
|
|
248
250
|
session.get()?.role,
|
|
@@ -258,7 +260,8 @@ function HonoInstance(): typeof app {
|
|
|
258
260
|
|
|
259
261
|
nextLifecyle = basicNextAccess;
|
|
260
262
|
|
|
261
|
-
|
|
263
|
+
// si pas de role alors checking les permissions par access
|
|
264
|
+
if (col?.access?.hasOwnProperty(action) && !basicNextAccess) {
|
|
262
265
|
nextLifecyle = await col?.access[action]({
|
|
263
266
|
session: sessionStorage(),
|
|
264
267
|
action: action,
|
|
@@ -901,7 +904,10 @@ function HonoInstance(): typeof app {
|
|
|
901
904
|
}
|
|
902
905
|
|
|
903
906
|
app.onError((err, c) => {
|
|
904
|
-
console.error(err?.message);
|
|
907
|
+
// console.error(err?.message);
|
|
908
|
+
if (plugins?.sentry) {
|
|
909
|
+
plugins?.sentry?.captureException(err) ?? null;
|
|
910
|
+
}
|
|
905
911
|
c.status(500);
|
|
906
912
|
return c.json({ message: err?.message });
|
|
907
913
|
});
|
package/index.ts
CHANGED
|
@@ -6,8 +6,10 @@ import * as v from "joi";
|
|
|
6
6
|
import { $ } from "bun";
|
|
7
7
|
import define from "./define";
|
|
8
8
|
import * as utils from "./utils";
|
|
9
|
+
import { app } from "./app/hono";
|
|
9
10
|
import { FilesystemSftpAdapter, MinioAdapter } from "./lib/media";
|
|
10
11
|
import { crypt } from "./lib/crypto";
|
|
12
|
+
import { plugins } from "./lib/plugins";
|
|
11
13
|
import { contextStorage } from "./lib/asyncLocalStorage";
|
|
12
14
|
import { Cron as Task } from "croner";
|
|
13
15
|
import { serveStatic } from "hono/bun";
|
|
@@ -21,6 +23,7 @@ const Adapter = {
|
|
|
21
23
|
};
|
|
22
24
|
|
|
23
25
|
export {
|
|
26
|
+
plugins,
|
|
24
27
|
runApp,
|
|
25
28
|
define,
|
|
26
29
|
utils,
|
package/lib/plugins.ts
ADDED