@npm.365xs.cn/vue-admin-framework 0.1.0 → 0.2.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.
- package/README.md +91 -63
- package/dist/access.d.ts +43 -0
- package/dist/components/AdminFrameworkLayout.vue.d.ts +2 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +702 -466
- package/dist/navigation.d.ts +6 -0
- package/dist/oauth.d.ts +4 -1
- package/dist/session.d.ts +32 -0
- package/package.json +37 -37
package/dist/navigation.d.ts
CHANGED
|
@@ -10,3 +10,9 @@ export declare function menuItemIndex(menu: FrameworkMenuNode): string;
|
|
|
10
10
|
* Resolves a trail by node identity rather than route (which may occur in many apps).
|
|
11
11
|
*/
|
|
12
12
|
export declare function findMenuTrailForItem(menus: FrameworkMenuNode[], target: FrameworkMenuNode, parents?: FrameworkMenuNode[]): FrameworkMenuNode[];
|
|
13
|
+
/** Normalizes the standard all-application menu response. */
|
|
14
|
+
export declare function normalizeFrameworkMenus(value: unknown): FrameworkMenuNode[];
|
|
15
|
+
/** Determines whether the visible menu grants allow entering an application page. */
|
|
16
|
+
export declare function hasPageAccess(menus: FrameworkMenuNode[], applicationCode: string, menuCode: string | null, apiCodes: string[]): boolean;
|
|
17
|
+
/** Creates a safe resolver for menus owned by another application. */
|
|
18
|
+
export declare function createExternalMenuHrefResolver(currentApplicationCode: string): (menu: FrameworkMenuNode) => string | null;
|
package/dist/oauth.d.ts
CHANGED
|
@@ -8,12 +8,15 @@ export interface OAuthPkceClient {
|
|
|
8
8
|
getSession(): OAuthSession | null;
|
|
9
9
|
clearSession(): void;
|
|
10
10
|
onSessionChanged(listener: () => void): () => void;
|
|
11
|
-
beginLogin(returnUrl?: string): Promise<void>;
|
|
11
|
+
beginLogin(returnUrl?: string, options?: OAuthLoginOptions): Promise<void>;
|
|
12
12
|
completeLogin(code: string, state: string): Promise<string>;
|
|
13
13
|
getValidAccessToken(): Promise<string | null>;
|
|
14
14
|
refreshAccessToken(): Promise<string | null>;
|
|
15
15
|
readAccessTokenSubject(accessToken: string): string;
|
|
16
16
|
}
|
|
17
|
+
export interface OAuthLoginOptions {
|
|
18
|
+
prompt?: 'login';
|
|
19
|
+
}
|
|
17
20
|
export interface OAuthPkceClientOptions {
|
|
18
21
|
authority: string;
|
|
19
22
|
clientId: string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ComputedRef, type Ref } from 'vue';
|
|
2
|
+
import { type AdminAccessClient, type FrameworkCurrentUser } from './access';
|
|
3
|
+
import type { FrameworkMenuNode } from './menu';
|
|
4
|
+
import type { OAuthPkceClient } from './oauth';
|
|
5
|
+
export interface AdminFrameworkSessionOptions {
|
|
6
|
+
oauthClient: OAuthPkceClient;
|
|
7
|
+
accessApiBaseUrl: string;
|
|
8
|
+
mockUser?: FrameworkCurrentUser;
|
|
9
|
+
mockMenus?: FrameworkMenuNode[];
|
|
10
|
+
defaultReturnUrl?: string;
|
|
11
|
+
accessClient?: AdminAccessClient;
|
|
12
|
+
storageKeysToClear?: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface AdminFrameworkSession {
|
|
15
|
+
accessToken: Ref<string>;
|
|
16
|
+
currentUser: Ref<FrameworkCurrentUser | null>;
|
|
17
|
+
username: Ref<string>;
|
|
18
|
+
loginAccount: Ref<string>;
|
|
19
|
+
menus: Ref<FrameworkMenuNode[]>;
|
|
20
|
+
navigationLoaded: Ref<boolean>;
|
|
21
|
+
navigationError: Ref<string>;
|
|
22
|
+
initials: ComputedRef<string>;
|
|
23
|
+
authenticated: ComputedRef<boolean>;
|
|
24
|
+
sync(): void;
|
|
25
|
+
ensureAuthenticated(): Promise<boolean>;
|
|
26
|
+
ensureLoaded(): Promise<void>;
|
|
27
|
+
ensureNavigation(): Promise<void>;
|
|
28
|
+
clear(): void;
|
|
29
|
+
login(returnUrl?: string): Promise<void>;
|
|
30
|
+
logout(returnUrl?: string): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
export declare function createAdminFrameworkSession(options: AdminFrameworkSessionOptions): AdminFrameworkSession;
|
package/package.json
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@npm.365xs.cn/vue-admin-framework",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Reusable Vue 3 authentication and admin shell framework for Shinesun applications.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"files": [
|
|
7
|
-
"dist",
|
|
8
|
-
"README.md"
|
|
9
|
-
],
|
|
10
|
-
"main": "./dist/index.js",
|
|
11
|
-
"module": "./dist/index.js",
|
|
12
|
-
"types": "./dist/index.d.ts",
|
|
13
|
-
"exports": {
|
|
14
|
-
".": {
|
|
15
|
-
"types": "./dist/index.d.ts",
|
|
16
|
-
"import": "./dist/index.js"
|
|
17
|
-
},
|
|
18
|
-
"./style.css": "./dist/style.css"
|
|
19
|
-
},
|
|
20
|
-
"sideEffects": [
|
|
21
|
-
"./dist/style.css"
|
|
22
|
-
],
|
|
23
|
-
"scripts": {
|
|
24
|
-
"build": "vite build && vue-tsc -p tsconfig.json --declaration --emitDeclarationOnly",
|
|
25
|
-
"typecheck": "vue-tsc -p tsconfig.json --noEmit"
|
|
26
|
-
},
|
|
27
|
-
"peerDependencies": {
|
|
28
|
-
"@element-plus/icons-vue": "^2.3.0",
|
|
29
|
-
"element-plus": "^2.11.0",
|
|
30
|
-
"vue": "^3.5.0",
|
|
31
|
-
"vue-router": "^4.5.0"
|
|
32
|
-
},
|
|
33
|
-
"publishConfig": {
|
|
34
|
-
"access": "public"
|
|
35
|
-
},
|
|
36
|
-
"license": "UNLICENSED"
|
|
37
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@npm.365xs.cn/vue-admin-framework",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Reusable Vue 3 authentication and admin shell framework for Shinesun applications.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"README.md"
|
|
9
|
+
],
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"module": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./style.css": "./dist/style.css"
|
|
19
|
+
},
|
|
20
|
+
"sideEffects": [
|
|
21
|
+
"./dist/style.css"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "vite build && vue-tsc -p tsconfig.json --declaration --emitDeclarationOnly",
|
|
25
|
+
"typecheck": "vue-tsc -p tsconfig.json --noEmit"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@element-plus/icons-vue": "^2.3.0",
|
|
29
|
+
"element-plus": "^2.11.0",
|
|
30
|
+
"vue": "^3.5.0",
|
|
31
|
+
"vue-router": "^4.5.0"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"license": "UNLICENSED"
|
|
37
|
+
}
|