@yusr_systems/core 6.0.3 → 6.0.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/dist/index.d.ts +2 -2
- package/dist/yusr-core.js +8 -12
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export declare class AuthConstants {
|
|
|
12
12
|
static AuthCheckStorageItemName: string;
|
|
13
13
|
static SettingStorageItemName: string;
|
|
14
14
|
static UnauthorizedEventName: string;
|
|
15
|
+
static FormatFunc: (resource: string, action: string) => string;
|
|
16
|
+
static InitFormatFunc(formatFunc: (resource: string, action: string) => string): void;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
export declare type AuthReducers<TUser extends object, TSetting extends object> = {
|
|
@@ -186,13 +188,11 @@ export declare const StorageFileStatus: {
|
|
|
186
188
|
export declare type StorageFileStatus = typeof StorageFileStatus[keyof typeof StorageFileStatus];
|
|
187
189
|
|
|
188
190
|
export declare class SystemPermissions {
|
|
189
|
-
static Format(resource: string, action: string): string;
|
|
190
191
|
static hasAuth(permissions: string[], resource: string, action: string): boolean;
|
|
191
192
|
private permissions;
|
|
192
193
|
private resource;
|
|
193
194
|
constructor(permissions: string[], resource: string);
|
|
194
195
|
hasAuth(action: string): boolean;
|
|
195
|
-
static getFirstPermissionPath(permissions: string[]): string;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
export declare class User extends BaseEntity {
|
package/dist/yusr-core.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { createSlice as e } from "@reduxjs/toolkit";
|
|
2
2
|
import { toast as t } from "sonner";
|
|
3
3
|
//#region src/auth/authConstants.ts
|
|
4
|
-
var n = class {
|
|
4
|
+
var n = class e {
|
|
5
5
|
static LoggedInUserStorageItemName = "LoggedInUser";
|
|
6
6
|
static AuthCheckStorageItemName = "IsLoggedIn";
|
|
7
7
|
static SettingStorageItemName = "Setting";
|
|
8
8
|
static UnauthorizedEventName = "ApiUnauthorized";
|
|
9
|
+
static FormatFunc = (e, t) => `${e}.${t}`;
|
|
10
|
+
static InitFormatFunc(t) {
|
|
11
|
+
e.FormatFunc = t;
|
|
12
|
+
}
|
|
9
13
|
}, r = () => {
|
|
10
14
|
let e = localStorage.getItem(n.AuthCheckStorageItemName) === "true", t = localStorage.getItem(n.LoggedInUserStorageItemName), r = localStorage.getItem(n.SettingStorageItemName);
|
|
11
15
|
return {
|
|
@@ -44,12 +48,9 @@ var n = class {
|
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
50
|
}), a = class e {
|
|
47
|
-
static
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
static hasAuth(e, t, n) {
|
|
51
|
-
let r = this.Format(t, n);
|
|
52
|
-
return e.includes(r);
|
|
51
|
+
static hasAuth(e, t, r) {
|
|
52
|
+
let i = n.FormatFunc(t, r);
|
|
53
|
+
return e.includes(i);
|
|
53
54
|
}
|
|
54
55
|
permissions;
|
|
55
56
|
resource;
|
|
@@ -59,11 +60,6 @@ var n = class {
|
|
|
59
60
|
hasAuth(t) {
|
|
60
61
|
return e.hasAuth(this.permissions, this.resource, t);
|
|
61
62
|
}
|
|
62
|
-
static getFirstPermissionPath(e) {
|
|
63
|
-
if (!e?.length) return "";
|
|
64
|
-
let [t] = e[0].split(":");
|
|
65
|
-
return `/${t.toLowerCase()}`;
|
|
66
|
-
}
|
|
67
63
|
}, o = class {
|
|
68
64
|
id;
|
|
69
65
|
}, s = class extends o {
|