@lanaqi/rsr 0.0.1 → 0.0.3
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/README.md +52 -28
- package/dist/access/blocker.d.ts +3 -3
- package/dist/access/resource.d.ts +5 -5
- package/dist/access/storer.d.ts +3 -3
- package/dist/bridge.d.ts +2 -2
- package/dist/index.js +845 -391
- package/dist/security/blocker.d.ts +5 -10
- package/dist/security/context.d.ts +9 -0
- package/dist/security/index.d.ts +4 -0
- package/dist/security/provider.d.ts +8 -14
- package/dist/support/aaa.d.ts +4 -6
- package/dist/support/signature.d.ts +2 -3
- package/dist/support/user.d.ts +6 -7
- package/dist/warpper/permission.d.ts +5 -9
- package/package.json +25 -15
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { type ComponentType, type PropsWithChildren } from 'react';
|
|
2
|
-
import { type SecurityBundler } from './provider';
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
5
|
-
* @param children 子组件
|
|
6
|
-
* @constructor
|
|
2
|
+
* 安全阻断器组件属性
|
|
7
3
|
*/
|
|
8
|
-
export
|
|
4
|
+
export interface SecurityBlockerProps extends React.PropsWithChildren {
|
|
5
|
+
}
|
|
9
6
|
/**
|
|
10
|
-
*
|
|
11
|
-
* @param Component 组件
|
|
12
|
-
* @param bundler 打包器
|
|
7
|
+
* 安全阻断器组件
|
|
13
8
|
*/
|
|
14
|
-
export declare
|
|
9
|
+
export declare function SecurityBlocker({ children }: SecurityBlockerProps): import("react").ReactNode;
|
package/dist/security/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type PropsWithChildren } from 'react';
|
|
2
1
|
import type { AccessProvider } from '../access';
|
|
3
2
|
import { AccessGuarderBuilder } from '../builder';
|
|
4
3
|
/**
|
|
@@ -6,26 +5,21 @@ import { AccessGuarderBuilder } from '../builder';
|
|
|
6
5
|
*/
|
|
7
6
|
export type SecurityBundler = (builder: AccessGuarderBuilder) => AccessProvider;
|
|
8
7
|
/**
|
|
9
|
-
*
|
|
8
|
+
* 安全提供者组件属性
|
|
10
9
|
*/
|
|
11
|
-
export
|
|
10
|
+
export interface SecurityProviderProps extends React.PropsWithChildren {
|
|
12
11
|
/**
|
|
13
12
|
* 打包器
|
|
14
13
|
*/
|
|
15
14
|
readonly bundler: SecurityBundler;
|
|
16
|
-
}
|
|
15
|
+
}
|
|
17
16
|
/**
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
export declare const SecurityContext: import("react").Context<AccessProvider | null>;
|
|
21
|
-
/**
|
|
22
|
-
* 安全上下文钩子
|
|
17
|
+
* 安全提供者组件
|
|
23
18
|
*/
|
|
24
|
-
export declare
|
|
19
|
+
export declare function SecurityProvider({ children, bundler }: SecurityProviderProps): string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
25
20
|
/**
|
|
26
|
-
*
|
|
27
|
-
* @param
|
|
21
|
+
* 安全阻断器包装
|
|
22
|
+
* @param Component 组件
|
|
28
23
|
* @param bundler 打包器
|
|
29
|
-
* @constructor
|
|
30
24
|
*/
|
|
31
|
-
export declare
|
|
25
|
+
export declare const withSecurityBlocker: (Component: React.ComponentType, bundler: SecurityBundler) => () => import("react/jsx-runtime").JSX.Element;
|
package/dist/support/aaa.d.ts
CHANGED
|
@@ -17,13 +17,11 @@ export declare const useDeleteAuthentication: () => (() => void);
|
|
|
17
17
|
export declare const useDeleteAuthorization: () => (() => void);
|
|
18
18
|
/**
|
|
19
19
|
* 保存认证钩子
|
|
20
|
-
* @param
|
|
21
|
-
* @param redirect 重定向路径(如果不存在原始路径时使用)
|
|
20
|
+
* @param redirect 重定向路径,当为空字符串时不进行重定向,默认:空(如果不存在原始路径时使用)
|
|
22
21
|
*/
|
|
23
|
-
export declare const useSaveAuthentication: <Datasheet>(
|
|
22
|
+
export declare const useSaveAuthentication: <Datasheet>(redirect?: string) => ((datasheet: AccessDatasheet<AuthenticationDatasheet<Datasheet>>) => void);
|
|
24
23
|
/**
|
|
25
24
|
* 保存授权钩子
|
|
26
|
-
* @param
|
|
27
|
-
* @param redirect 重定向路径(如果不存在原始路径时使用)
|
|
25
|
+
* @param redirect 重定向路径,当为空字符串时不进行重定向,默认:空(如果不存在原始路径时使用)
|
|
28
26
|
*/
|
|
29
|
-
export declare const useSaveAuthorization: <Datasheet>(
|
|
27
|
+
export declare const useSaveAuthorization: <Datasheet>(redirect?: string) => ((datasheet: AccessDatasheet<AuthorizationDatasheet<Datasheet>>) => void);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { AccessPath } from '../access';
|
|
2
2
|
/**
|
|
3
3
|
* 保存签名钩子
|
|
4
|
-
* @param
|
|
5
|
-
* @param redirect 重定向路径(如果不存在原始路径时使用)
|
|
4
|
+
* @param redirect 重定向路径,当为空字符串时不进行重定向,默认:'/'(如果不存在原始路径时使用)
|
|
6
5
|
*/
|
|
7
|
-
export declare const useSaveSignature: (
|
|
6
|
+
export declare const useSaveSignature: (redirect?: string) => ((path?: AccessPath) => void);
|
|
8
7
|
/**
|
|
9
8
|
* 删除签名钩子
|
|
10
9
|
*/
|
package/dist/support/user.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import type { AccessDatasheet, UserDatasheet } from '../access';
|
|
2
2
|
/**
|
|
3
3
|
* 登出钩子
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
4
|
+
* @param cRedirect 当前重定向路径,当为空字符串时不进行重定向,默认:'/'
|
|
5
|
+
* @param pRedirect 父级重定向路径,当为空字符串时不进行重定向,默认:'/'(如果存在父级时才会生效)
|
|
6
6
|
*/
|
|
7
|
-
export declare const useLogout: (
|
|
7
|
+
export declare const useLogout: (cRedirect?: string, pRedirect?: string) => (() => void);
|
|
8
8
|
/**
|
|
9
9
|
* 登入钩子
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @param redirect 重定向路径(如果不存在原始路径时使用)
|
|
10
|
+
* @param cRedirect 当前重定向路径,当为空字符串时不进行重定向,默认:'/'(如果不存在原始路径时使用)
|
|
11
|
+
* @param pRedirect 父级重定向路径,当为空字符串时不进行重定向,默认:'/'(如果存在父级时才会生效)
|
|
13
12
|
*/
|
|
14
|
-
export declare const useLogin: <Datasheet>(
|
|
13
|
+
export declare const useLogin: <Datasheet>(cRedirect?: string, pRedirect?: string) => ((datasheet: AccessDatasheet<UserDatasheet<Datasheet>>) => void);
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import type { ComponentType, PropsWithChildren } from 'react';
|
|
2
1
|
import type { AccessPermission, AccessPermissions } from '../access';
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
3
|
+
* 拥有权限组件属性
|
|
5
4
|
*/
|
|
6
|
-
export
|
|
5
|
+
export interface HavePermissionProps extends React.PropsWithChildren {
|
|
7
6
|
/**
|
|
8
7
|
* 条件
|
|
9
8
|
*/
|
|
10
9
|
readonly term: AccessPermission | AccessPermissions;
|
|
11
|
-
}
|
|
10
|
+
}
|
|
12
11
|
/**
|
|
13
12
|
* 拥有权限组件
|
|
14
|
-
* @param children 子组件
|
|
15
|
-
* @param term 条件
|
|
16
|
-
* @constructor
|
|
17
13
|
*/
|
|
18
|
-
export declare function HavePermission({ children, term }:
|
|
14
|
+
export declare function HavePermission({ children, term }: HavePermissionProps): import("react").ReactNode;
|
|
19
15
|
/**
|
|
20
16
|
* 拥有权限包装
|
|
21
17
|
* @param Component 组件
|
|
22
18
|
* @param term 条件
|
|
23
19
|
*/
|
|
24
|
-
export declare const withHavePermission: (Component: ComponentType, term: AccessPermission | AccessPermissions) => () => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare const withHavePermission: (Component: React.ComponentType, term: AccessPermission | AccessPermissions) => () => import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lanaqi/rsr",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
},
|
|
11
11
|
"module": "./dist/index.js",
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
|
-
"files": [
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
14
16
|
"keywords": [
|
|
15
17
|
"react",
|
|
16
18
|
"router",
|
|
@@ -24,9 +26,15 @@
|
|
|
24
26
|
"router-guard",
|
|
25
27
|
"react-router-guard",
|
|
26
28
|
"react-router",
|
|
27
|
-
"react-router
|
|
29
|
+
"react-router",
|
|
28
30
|
"modern-js",
|
|
29
31
|
"modernjs",
|
|
32
|
+
"auth",
|
|
33
|
+
"authentication",
|
|
34
|
+
"authorization",
|
|
35
|
+
"csr",
|
|
36
|
+
"rsr",
|
|
37
|
+
"纯前端",
|
|
30
38
|
"安全",
|
|
31
39
|
"鉴权",
|
|
32
40
|
"守护",
|
|
@@ -47,20 +55,22 @@
|
|
|
47
55
|
"release": "npm run build && npm publish"
|
|
48
56
|
},
|
|
49
57
|
"devDependencies": {
|
|
50
|
-
"@biomejs/biome": "
|
|
51
|
-
"@rsbuild/plugin-
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@types/react
|
|
55
|
-
"react": "^19.
|
|
56
|
-
"react-
|
|
57
|
-
"react
|
|
58
|
-
"
|
|
58
|
+
"@biomejs/biome": "2.4.15",
|
|
59
|
+
"@rsbuild/plugin-babel": "^1.1.2",
|
|
60
|
+
"@rsbuild/plugin-react": "^2.0.0",
|
|
61
|
+
"@rslib/core": "0.21.5",
|
|
62
|
+
"@types/react": "^19.2.14",
|
|
63
|
+
"@types/react-dom": "^19.2.3",
|
|
64
|
+
"babel-plugin-react-compiler": "^1.0.0",
|
|
65
|
+
"react": "^19.2.6",
|
|
66
|
+
"react-dom": "^19.2.6",
|
|
67
|
+
"react-router": "^7.15.1",
|
|
68
|
+
"typescript": "^6.0.3"
|
|
59
69
|
},
|
|
60
70
|
"peerDependencies": {
|
|
61
|
-
"react": ">=
|
|
62
|
-
"react-dom": ">=
|
|
63
|
-
"react-router
|
|
71
|
+
"react": ">=19.0.0",
|
|
72
|
+
"react-dom": ">=19.0.0",
|
|
73
|
+
"react-router": "^7.0.0"
|
|
64
74
|
},
|
|
65
75
|
"private": false,
|
|
66
76
|
"publishConfig": {
|