@morningfast/platform 1.0.6 → 1.0.8
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/chunks/{Login-7n7MU-kG.js → Login-BU39vYjX.js} +2 -4
- package/dist/chunks/{SystemConfig-DGZUwXWB.js → SystemConfig-C7oT7l8o.js} +2 -3
- package/dist/chunks/{application-config-DePctoXE.js → application-config-Bz36uajb.js} +12 -13
- package/dist/chunks/{system-DZaKDrG6.js → main-C2CR17WW.js} +3340 -91
- package/dist/index.js +4 -7
- package/dist/main.js +2 -5
- package/dist/{auth → src/auth}/index.d.ts +1 -1
- package/dist/{main → src/main}/api/client.d.ts +2 -2
- package/dist/src/main/api/types.d.ts +1 -0
- package/dist/{main → src/main}/app/create-app.d.ts +2 -2
- package/dist/{main → src/main}/layouts/components/AppHeaderMenuNode.vue.d.ts +1 -1
- package/dist/{main → src/main}/layouts/components/AppMenuSearchItem.vue.d.ts +1 -1
- package/dist/{main → src/main}/layouts/components/AppMenuSearchTrigger.vue.d.ts +1 -1
- package/dist/{main → src/main}/layouts/components/AppSidebarNode.vue.d.ts +1 -1
- package/dist/{main → src/main}/layouts/components/AppTabsContextMenu.vue.d.ts +1 -1
- package/dist/{main → src/main}/layouts/utils/menuSearch.d.ts +1 -1
- package/dist/{main → src/main}/router/index.d.ts +1 -1
- package/dist/{main → src/main}/stores/app.d.ts +1 -1
- package/dist/{main → src/main}/stores/auth.d.ts +4 -4
- package/dist/{main → src/main}/utils/auth.d.ts +1 -1
- package/dist/{sub → src/sub}/composables/useRequestClient.d.ts +2 -2
- package/dist/{sub → src/sub}/router/index.d.ts +2 -2
- package/dist/sub.js +2 -2
- package/package.json +8 -8
- package/dist/chunks/_plugin-vue_export-helper-DvRHjpsZ.js +0 -8
- package/dist/chunks/auth-C3RvRgcW.js +0 -248
- package/dist/chunks/main-8Nctu65O.js +0 -2441
- package/dist/chunks/register-dGBgzdRh.js +0 -575
- package/dist/main/api/types.d.ts +0 -1
- /package/dist/chunks/{Forbidden-Cu2QQ-FY.js → Forbidden-BM9uDrLP.js} +0 -0
- /package/dist/chunks/{NotFound-VRL7_aMx.js → NotFound-CeLeTD4e.js} +0 -0
- /package/dist/chunks/{route-items-CYTYHd0U.js → route-items-9aVNyGkB.js} +0 -0
- /package/dist/chunks/{storage-DNllLr_D.js → storage-BSJwKVAK.js} +0 -0
- /package/dist/chunks/{sub-LssKnIb1.js → sub-DtGKYpEu.js} +0 -0
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{main → src/main}/api/adapter.d.ts +0 -0
- /package/dist/{main → src/main}/api/auth.d.ts +0 -0
- /package/dist/{main → src/main}/app/AppUpdateDialog.vue.d.ts +0 -0
- /package/dist/{main → src/main}/app/runtime-config.d.ts +0 -0
- /package/dist/{main → src/main}/app/update-checker.d.ts +0 -0
- /package/dist/{main → src/main}/app/update-preferences.d.ts +0 -0
- /package/dist/{main → src/main}/auth/expired.d.ts +0 -0
- /package/dist/{main → src/main}/composables/useSortable.d.ts +0 -0
- /package/dist/{main → src/main}/directives/index.d.ts +0 -0
- /package/dist/{main → src/main}/index.d.ts +0 -0
- /package/dist/{main → src/main}/layouts/AppLayout.vue.d.ts +0 -0
- /package/dist/{main → src/main}/layouts/components/AppBrandLogo.vue.d.ts +0 -0
- /package/dist/{main → src/main}/layouts/components/AppContentView.vue.d.ts +0 -0
- /package/dist/{main → src/main}/layouts/components/AppHeader.vue.d.ts +0 -0
- /package/dist/{main → src/main}/layouts/components/AppMenuSearch.vue.d.ts +0 -0
- /package/dist/{main → src/main}/layouts/components/AppSidebar.vue.d.ts +0 -0
- /package/dist/{main → src/main}/layouts/components/AppSidebarSearch.vue.d.ts +0 -0
- /package/dist/{main → src/main}/layouts/components/AppTabs.vue.d.ts +0 -0
- /package/dist/{main → src/main}/layouts/composables/useAppMenus.d.ts +0 -0
- /package/dist/{main → src/main}/layouts/composables/useShortcutLabel.d.ts +0 -0
- /package/dist/{main → src/main}/layouts/utils/menuIcons.d.ts +0 -0
- /package/dist/{main → src/main}/micro-apps/config.d.ts +0 -0
- /package/dist/{main → src/main}/micro-apps/register.d.ts +0 -0
- /package/dist/{main → src/main}/micro-apps/status.d.ts +0 -0
- /package/dist/{main → src/main}/micro-apps/types.d.ts +0 -0
- /package/dist/{main → src/main}/pages/auth/Login.vue.d.ts +0 -0
- /package/dist/{main → src/main}/pages/error/Forbidden.vue.d.ts +0 -0
- /package/dist/{main → src/main}/pages/error/NotFound.vue.d.ts +0 -0
- /package/dist/{main → src/main}/pages/micro/MicroAppView.vue.d.ts +0 -0
- /package/dist/{main → src/main}/pages/system/SystemConfig.vue.d.ts +0 -0
- /package/dist/{main → src/main}/pages/system/application-config/index.vue.d.ts +0 -0
- /package/dist/{main → src/main}/router/base-routes.d.ts +0 -0
- /package/dist/{main → src/main}/router/guard.d.ts +0 -0
- /package/dist/{main → src/main}/router/route-items.d.ts +0 -0
- /package/dist/{main → src/main}/settings/components/AppearanceSettings.vue.d.ts +0 -0
- /package/dist/{main → src/main}/settings/components/GeneralSettings.vue.d.ts +0 -0
- /package/dist/{main → src/main}/settings/components/LayoutSettings.vue.d.ts +0 -0
- /package/dist/{main → src/main}/settings/components/ShortcutSettings.vue.d.ts +0 -0
- /package/dist/{main → src/main}/settings/components/SystemSettingsDrawer.vue.d.ts +0 -0
- /package/dist/{main → src/main}/settings/components/ThemeToggleButton.vue.d.ts +0 -0
- /package/dist/{main → src/main}/settings/components/ThemedSvgImage.vue.d.ts +0 -0
- /package/dist/{main → src/main}/stores/index.d.ts +0 -0
- /package/dist/{main → src/main}/stores/shortcut.d.ts +0 -0
- /package/dist/{main → src/main}/stores/system.d.ts +0 -0
- /package/dist/{main → src/main}/stores/tabs.d.ts +0 -0
- /package/dist/{main → src/main}/utils/keyboard-shortcut.d.ts +0 -0
- /package/dist/{main → src/main}/utils/persistence.d.ts +0 -0
- /package/dist/{main → src/main}/utils/storage.d.ts +0 -0
- /package/dist/{main → src/main}/utils/theme.d.ts +0 -0
- /package/dist/{micro-contract → src/micro-contract}/index.d.ts +0 -0
- /package/dist/{request → src/request}/index.d.ts +0 -0
- /package/dist/{shared → src/shared}/router/route-items.d.ts +0 -0
- /package/dist/{sub → src/sub}/app/mount.d.ts +0 -0
- /package/dist/{sub → src/sub}/composables/useSubAppContext.d.ts +0 -0
- /package/dist/{sub → src/sub}/context/sub-app-context.d.ts +0 -0
- /package/dist/{sub → src/sub}/index.d.ts +0 -0
- /package/dist/{sub → src/sub}/qiankun/index.d.ts +0 -0
- /package/dist/{sub → src/sub}/theme/index.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { MICRO_AUTH_EXPIRED_EVENT as e } from "./micro-contract.js";
|
|
2
|
-
import {
|
|
3
|
-
import { ApiError as
|
|
4
|
-
import { a as
|
|
5
|
-
|
|
6
|
-
import { g as N, h as P } from "./chunks/register-dGBgzdRh.js";
|
|
7
|
-
import { a as F, c as I, d as L, l as R, n as z, o as B, r as V, s as H, t as U, u as W } from "./chunks/sub-LssKnIb1.js";
|
|
8
|
-
export { b as ApiError, p as HOME_TAB_PATH, e as MICRO_AUTH_EXPIRED_EVENT, r as MicroAppView, x as RequestManager, F as SUB_APP_NAME, B as SUB_APP_THEME_CHANGE_EVENT, z as applySubAppTheme, s as configureMorningfastRequestClient, o as createApi, E as createMockLoginResult, D as createMockUserProfile, _ as createMorningfastBaseRoutes, l as createMorningfastRouter, S as createRequestClient, h as createRoutesFromItems, W as createSubAppContext, V as createSubAppRouter, C as formatErrorMessage, A as getPersistedValue, n as getStoredUpdateCheckEnabled, t as http, g as mountMorningfastApp, U as mountSubApp, T as normalizeLoginResult, w as normalizeUserProfile, j as removePersistedValue, v as requestManager, H as resolveSubAppBasePath, d as restartAppUpdateChecker, P as setDefaultAppConfigs, k as setPersistedValue, f as setStoredUpdateCheckEnabled, m as setupAppUpdateChecker, y as setupAuthExpiredHandler, c as stopAppUpdateChecker, L as subAppContextKey, N as useAppStore, O as useAuthStore, I as useRequestClient, a as useShortcutStore, i as useSortable, R as useSubAppContext, M as useSystemStore, u as useTabsStore };
|
|
2
|
+
import { A as t, C as n, D as r, E as i, F as a, I as o, L as s, M as c, N as l, O as u, P as d, R as f, S as p, T as m, a as h, c as g, d as _, i as v, j as y, k as b, l as x, n as S, o as C, r as w, s as T, t as E, u as D, w as O, x as k, z as A } from "./chunks/main-C2CR17WW.js";
|
|
3
|
+
import { ApiError as j, RequestManager as M, createRequestClient as N, formatErrorMessage as P } from "./request.js";
|
|
4
|
+
import { a as F, c as I, d as L, l as R, n as z, o as B, r as V, s as H, t as U, u as W } from "./chunks/sub-DtGKYpEu.js";
|
|
5
|
+
export { j as ApiError, O as HOME_TAB_PATH, e as MICRO_AUTH_EXPIRED_EVENT, g as MicroAppView, M as RequestManager, F as SUB_APP_NAME, B as SUB_APP_THEME_CHANGE_EVENT, z as applySubAppTheme, a as configureMorningfastRequestClient, o as createApi, y as createMockLoginResult, c as createMockUserProfile, D as createMorningfastBaseRoutes, x as createMorningfastRouter, N as createRequestClient, T as createRoutesFromItems, W as createSubAppContext, V as createSubAppRouter, P as formatErrorMessage, r as getPersistedValue, h as getStoredUpdateCheckEnabled, s as http, E as mountMorningfastApp, U as mountSubApp, l as normalizeLoginResult, d as normalizeUserProfile, u as removePersistedValue, f as requestManager, H as resolveSubAppBasePath, S as restartAppUpdateChecker, k as setDefaultAppConfigs, b as setPersistedValue, C as setStoredUpdateCheckEnabled, w as setupAppUpdateChecker, A as setupAuthExpiredHandler, v as stopAppUpdateChecker, L as subAppContextKey, n as useAppStore, t as useAuthStore, I as useRequestClient, p as useShortcutStore, _ as useSortable, R as useSubAppContext, i as useSystemStore, m as useTabsStore };
|
package/dist/main.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { i as w, n as T, r as E, t as D } from "./chunks/system-DZaKDrG6.js";
|
|
4
|
-
import { g as O, h as k } from "./chunks/register-dGBgzdRh.js";
|
|
5
|
-
export { f as HOME_TAB_PATH, n as MicroAppView, o as configureMorningfastRequestClient, a as createApi, x as createMockLoginResult, S as createMockUserProfile, g as createMorningfastBaseRoutes, c as createMorningfastRouter, m as createRoutesFromItems, T as getPersistedValue, t as getStoredUpdateCheckEnabled, e as http, h as mountMorningfastApp, b as normalizeLoginResult, y as normalizeUserProfile, E as removePersistedValue, _ as requestManager, u as restartAppUpdateChecker, k as setDefaultAppConfigs, w as setPersistedValue, d as setStoredUpdateCheckEnabled, p as setupAppUpdateChecker, v as setupAuthExpiredHandler, s as stopAppUpdateChecker, O as useAppStore, C as useAuthStore, i as useShortcutStore, r as useSortable, D as useSystemStore, l as useTabsStore };
|
|
1
|
+
import { A as e, C as t, D as n, E as r, F as i, I as a, L as o, M as s, N as c, O as l, P as u, R as d, S as f, T as p, a as m, c as h, d as g, i as _, j as v, k as y, l as b, n as x, o as S, r as C, s as w, t as T, u as E, w as D, x as O, z as k } from "./chunks/main-C2CR17WW.js";
|
|
2
|
+
export { D as HOME_TAB_PATH, h as MicroAppView, i as configureMorningfastRequestClient, a as createApi, v as createMockLoginResult, s as createMockUserProfile, E as createMorningfastBaseRoutes, b as createMorningfastRouter, w as createRoutesFromItems, n as getPersistedValue, m as getStoredUpdateCheckEnabled, o as http, T as mountMorningfastApp, c as normalizeLoginResult, u as normalizeUserProfile, l as removePersistedValue, d as requestManager, x as restartAppUpdateChecker, O as setDefaultAppConfigs, y as setPersistedValue, S as setStoredUpdateCheckEnabled, C as setupAppUpdateChecker, k as setupAuthExpiredHandler, _ as stopAppUpdateChecker, t as useAppStore, e as useAuthStore, f as useShortcutStore, g as useSortable, r as useSystemStore, p as useTabsStore };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { ApiError, ApiResponse, ManagedApi, ManagedRequestConfig, PageQuery, PageResult, RequestConfig, RequestErrorContext, } from '
|
|
2
|
-
export declare const http: import('axios').AxiosInstance, createApi: <Params = void, Result = void>(option: import('
|
|
1
|
+
export type { ApiError, ApiResponse, ManagedApi, ManagedRequestConfig, PageQuery, PageResult, RequestConfig, RequestErrorContext, } from '../../../request';
|
|
2
|
+
export declare const http: import('axios').AxiosInstance, createApi: <Params = void, Result = void>(option: import('../../../request').ManagedRequestConfig) => import('../../../request').ManagedApi<Params, Result>, requestManager: import('../../../request').RequestManager;
|
|
3
3
|
export declare function configureMorningfastRequestClient(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { ApiResponse, ManagedRequestConfig, PageQuery, PageResult, RequestConfig, RequestErrorContext, } from '../../../request';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { App as VueApp, Component } from 'vue';
|
|
2
2
|
import { Pinia } from 'pinia';
|
|
3
3
|
import { Router, RouterHistory, RouterScrollBehavior, RouteRecordRaw } from 'vue-router';
|
|
4
|
-
import { http, requestManager } from '
|
|
5
|
-
import { MorningfastAppConfig } from '
|
|
4
|
+
import { http, requestManager } from '../../../main/api/client';
|
|
5
|
+
import { MorningfastAppConfig } from '../../../main/app/runtime-config';
|
|
6
6
|
export interface MountMorningfastAppOptions {
|
|
7
7
|
appConfig: MorningfastAppConfig;
|
|
8
8
|
businessRoutes?: RouteRecordRaw[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AppMenuNode } from '
|
|
1
|
+
import { AppMenuNode } from '../../../../main/layouts/composables/useAppMenus';
|
|
2
2
|
export declare function filterMenuTree(nodes: readonly AppMenuNode[], keyword: string): AppMenuNode[];
|
|
3
3
|
export declare function highlightMenuTitle(title: string, keyword: string): string;
|
|
@@ -5,4 +5,4 @@ export interface CreateMorningfastRouterOptions {
|
|
|
5
5
|
scrollBehavior?: RouterScrollBehavior;
|
|
6
6
|
setupRouter?: (router: Router) => void;
|
|
7
7
|
}
|
|
8
|
-
export declare function createMorningfastRouter(businessRoutesOrOptions?: RouteRecordRaw[] | CreateMorningfastRouterOptions):
|
|
8
|
+
export declare function createMorningfastRouter(businessRoutesOrOptions?: RouteRecordRaw[] | CreateMorningfastRouterOptions): import('vue-router')._RouterClassic;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ThemeColorPosition, ThemeMode } from '
|
|
1
|
+
import { ThemeColorPosition, ThemeMode } from '../../../main/utils/theme';
|
|
2
2
|
export type LayoutMode = 'default' | 'side' | 'top' | 'mix';
|
|
3
3
|
export type MenuSearchPlacement = 'header' | 'sidebar';
|
|
4
4
|
export declare const useAppStore: import('pinia').StoreDefinition<"app", Pick<{
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AuthRole, AuthUser } from '
|
|
1
|
+
import { AuthRole, AuthUser } from '../../../main/api/adapter';
|
|
2
2
|
export declare const useAuthStore: import('pinia').StoreDefinition<"auth", Pick<{
|
|
3
3
|
initAuth: () => Promise<void>;
|
|
4
4
|
isAuthenticated: import('vue').ComputedRef<boolean>;
|
|
5
5
|
login: (payload: {
|
|
6
6
|
username: string;
|
|
7
7
|
password?: string;
|
|
8
|
-
}) => Promise<import('
|
|
8
|
+
}) => Promise<import('../../../main/api/adapter').NormalizedLoginResult>;
|
|
9
9
|
logout: () => Promise<void>;
|
|
10
10
|
hasPermission: (permission: string) => boolean;
|
|
11
11
|
initialized: import('vue').Ref<boolean, boolean>;
|
|
@@ -41,7 +41,7 @@ export declare const useAuthStore: import('pinia').StoreDefinition<"auth", Pick<
|
|
|
41
41
|
login: (payload: {
|
|
42
42
|
username: string;
|
|
43
43
|
password?: string;
|
|
44
|
-
}) => Promise<import('
|
|
44
|
+
}) => Promise<import('../../../main/api/adapter').NormalizedLoginResult>;
|
|
45
45
|
logout: () => Promise<void>;
|
|
46
46
|
hasPermission: (permission: string) => boolean;
|
|
47
47
|
initialized: import('vue').Ref<boolean, boolean>;
|
|
@@ -77,7 +77,7 @@ export declare const useAuthStore: import('pinia').StoreDefinition<"auth", Pick<
|
|
|
77
77
|
login: (payload: {
|
|
78
78
|
username: string;
|
|
79
79
|
password?: string;
|
|
80
|
-
}) => Promise<import('
|
|
80
|
+
}) => Promise<import('../../../main/api/adapter').NormalizedLoginResult>;
|
|
81
81
|
logout: () => Promise<void>;
|
|
82
82
|
hasPermission: (permission: string) => boolean;
|
|
83
83
|
initialized: import('vue').Ref<boolean, boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { clearAccessToken as clearToken, getAccessToken as getToken, setAccessToken as setToken, } from '
|
|
1
|
+
export { clearAccessToken as clearToken, getAccessToken as getToken, setAccessToken as setToken, } from '../../../auth';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SubAppContext } from '../context/sub-app-context';
|
|
2
2
|
export declare function useRequestClient(providedContext?: SubAppContext): {
|
|
3
3
|
http: import('axios').AxiosInstance;
|
|
4
|
-
createApi: <Params = void, Result = void>(option: import('
|
|
5
|
-
requestManager: import('
|
|
4
|
+
createApi: <Params = void, Result = void>(option: import('../../../request').ManagedRequestConfig) => import('../../../request').ManagedApi<Params, Result>;
|
|
5
|
+
requestManager: import('../../../request').RequestManager;
|
|
6
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RouteRecordRaw } from 'vue-router';
|
|
2
|
-
import { RequestManager } from '
|
|
2
|
+
import { RequestManager } from '../../../request';
|
|
3
3
|
export interface CreateSubAppRouterOptions {
|
|
4
4
|
requestManager?: RequestManager;
|
|
5
5
|
}
|
|
6
|
-
export declare function createSubAppRouter(routes: RouteRecordRaw[], base?: string, options?: CreateSubAppRouterOptions): import('vue-router').
|
|
6
|
+
export declare function createSubAppRouter(routes: RouteRecordRaw[], base?: string, options?: CreateSubAppRouterOptions): import('vue-router')._RouterClassic;
|
package/dist/sub.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as e } from "./chunks/route-items-
|
|
2
|
-
import { a as t, c as n, d as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "./chunks/sub-
|
|
1
|
+
import { t as e } from "./chunks/route-items-9aVNyGkB.js";
|
|
2
|
+
import { a as t, c as n, d as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "./chunks/sub-DtGKYpEu.js";
|
|
3
3
|
export { i as DEFAULT_SUB_APP_BASE, t as SUB_APP_NAME, s as SUB_APP_THEME_CHANGE_EVENT, o as applySubAppTheme, e as createRoutesFromItems, d as createSubAppContext, c as createSubAppRouter, u as mountSubApp, l as resolveSubAppBasePath, r as subAppContextKey, n as useRequestClient, a as useSubAppContext };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morningfast/platform",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Morningfast platform runtime for main and sub applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"morningfast-plus": "^1.1.0",
|
|
53
52
|
"localforage": "^1.10.0",
|
|
53
|
+
"morningfast-plus": "^1.1.3",
|
|
54
54
|
"nprogress": "^0.2.0",
|
|
55
|
-
"single-spa": "^5.9.
|
|
55
|
+
"single-spa": "^5.9.5",
|
|
56
56
|
"vite-plugin-qiankun": "^1.0.15"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@types/nprogress": "^0.2.3",
|
|
70
70
|
"@types/sortablejs": "^1.15.9",
|
|
71
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
71
|
+
"@vitejs/plugin-vue": "^6.0.7",
|
|
72
72
|
"@vue/tsconfig": "^0.9.1",
|
|
73
|
-
"typescript": "~6.0.
|
|
74
|
-
"vite": "^8.0.
|
|
75
|
-
"vite-plugin-dts": "^5.0.
|
|
76
|
-
"vue-tsc": "^3.
|
|
73
|
+
"typescript": "~6.0.3",
|
|
74
|
+
"vite": "^8.0.16",
|
|
75
|
+
"vite-plugin-dts": "^5.0.2",
|
|
76
|
+
"vue-tsc": "^3.3.3"
|
|
77
77
|
},
|
|
78
78
|
"engines": {
|
|
79
79
|
"node": ">=22.12.0"
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import { clearAccessToken as e, clearAuthProfile as t, getAccessToken as n, setAccessToken as r, setAuthProfile as i } from "../auth.js";
|
|
2
|
-
import { n as a, r as o, t as s } from "./storage-DNllLr_D.js";
|
|
3
|
-
import { computed as c, ref as l } from "vue";
|
|
4
|
-
import { defineStore as u } from "pinia";
|
|
5
|
-
//#region src/main/api/adapter.ts
|
|
6
|
-
var d = {
|
|
7
|
-
id: "mock-admin",
|
|
8
|
-
name: "admin",
|
|
9
|
-
role: "admin",
|
|
10
|
-
roleLabel: "系统管理员"
|
|
11
|
-
}, f = [{
|
|
12
|
-
id: "admin",
|
|
13
|
-
code: "admin",
|
|
14
|
-
name: "系统管理员"
|
|
15
|
-
}], p = [
|
|
16
|
-
"system:user:view",
|
|
17
|
-
"system:user:create",
|
|
18
|
-
"system:user:edit"
|
|
19
|
-
];
|
|
20
|
-
function m(e) {
|
|
21
|
-
return { token: `mock-token-${e || d.name}` };
|
|
22
|
-
}
|
|
23
|
-
function h() {
|
|
24
|
-
return {
|
|
25
|
-
user: d,
|
|
26
|
-
roles: f,
|
|
27
|
-
permissions: p,
|
|
28
|
-
menus: []
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
function g(e, t = "") {
|
|
32
|
-
if (!e || typeof e != "object") return m(t);
|
|
33
|
-
let n = e;
|
|
34
|
-
return { token: T(w(n.data) ?? n, [
|
|
35
|
-
"token",
|
|
36
|
-
"accessToken",
|
|
37
|
-
"access_token"
|
|
38
|
-
]) || m(t).token };
|
|
39
|
-
}
|
|
40
|
-
function _(e) {
|
|
41
|
-
if (!e || typeof e != "object") return h();
|
|
42
|
-
let t = e, n = w(t.data) ?? t, r = v(n.user ?? n.userInfo ?? n.user_info), i = b(n.roles ?? n.roleList ?? n.role_list ?? n.userRoles), a = C(n.menus ?? n.menu ?? n.routes ?? n.router);
|
|
43
|
-
return {
|
|
44
|
-
user: r,
|
|
45
|
-
roles: i,
|
|
46
|
-
permissions: y(n.permissions ?? n.permission),
|
|
47
|
-
menus: a
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function v(e, t = "") {
|
|
51
|
-
let n = w(e);
|
|
52
|
-
return n ? {
|
|
53
|
-
id: T(n, [
|
|
54
|
-
"id",
|
|
55
|
-
"userId",
|
|
56
|
-
"user_id"
|
|
57
|
-
]) || E(n, [
|
|
58
|
-
"id",
|
|
59
|
-
"userId",
|
|
60
|
-
"user_id"
|
|
61
|
-
]),
|
|
62
|
-
name: T(n, [
|
|
63
|
-
"name",
|
|
64
|
-
"username",
|
|
65
|
-
"nickname",
|
|
66
|
-
"realName"
|
|
67
|
-
]) || t || d.name,
|
|
68
|
-
role: T(n, [
|
|
69
|
-
"role",
|
|
70
|
-
"roleCode",
|
|
71
|
-
"role_code"
|
|
72
|
-
]) || d.role,
|
|
73
|
-
roleLabel: T(n, [
|
|
74
|
-
"roleLabel",
|
|
75
|
-
"roleName",
|
|
76
|
-
"role_name"
|
|
77
|
-
]) || d.roleLabel
|
|
78
|
-
} : {
|
|
79
|
-
...d,
|
|
80
|
-
name: t || d.name
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
function y(e) {
|
|
84
|
-
let t = /* @__PURE__ */ new Set();
|
|
85
|
-
return S(e, t), t.size ? Array.from(t) : p;
|
|
86
|
-
}
|
|
87
|
-
function b(e) {
|
|
88
|
-
if (!e) return f;
|
|
89
|
-
if (typeof e == "string") return [{
|
|
90
|
-
code: e,
|
|
91
|
-
name: e
|
|
92
|
-
}];
|
|
93
|
-
if (!Array.isArray(e)) {
|
|
94
|
-
let t = x(e);
|
|
95
|
-
return t ? [t] : f;
|
|
96
|
-
}
|
|
97
|
-
let t = e.map((e) => x(e)).filter((e) => !!e);
|
|
98
|
-
return t.length ? t : f;
|
|
99
|
-
}
|
|
100
|
-
function x(e) {
|
|
101
|
-
if (typeof e == "string") return {
|
|
102
|
-
code: e,
|
|
103
|
-
name: e
|
|
104
|
-
};
|
|
105
|
-
let t = w(e);
|
|
106
|
-
if (!t) return null;
|
|
107
|
-
let n = T(t, [
|
|
108
|
-
"code",
|
|
109
|
-
"roleCode",
|
|
110
|
-
"role_code",
|
|
111
|
-
"key",
|
|
112
|
-
"value"
|
|
113
|
-
]), r = T(t, [
|
|
114
|
-
"name",
|
|
115
|
-
"roleName",
|
|
116
|
-
"role_name",
|
|
117
|
-
"label",
|
|
118
|
-
"title"
|
|
119
|
-
]) || n;
|
|
120
|
-
return !n && !r ? null : {
|
|
121
|
-
id: T(t, [
|
|
122
|
-
"id",
|
|
123
|
-
"roleId",
|
|
124
|
-
"role_id"
|
|
125
|
-
]) || E(t, [
|
|
126
|
-
"id",
|
|
127
|
-
"roleId",
|
|
128
|
-
"role_id"
|
|
129
|
-
]),
|
|
130
|
-
code: n || r,
|
|
131
|
-
name: r
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
function S(e, t) {
|
|
135
|
-
if (!e) return;
|
|
136
|
-
if (typeof e == "string") {
|
|
137
|
-
t.add(e);
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
if (Array.isArray(e)) {
|
|
141
|
-
e.forEach((e) => S(e, t));
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
let n = w(e);
|
|
145
|
-
n && (S(n.path, t), S(n.code, t), S(n.permission, t), S(n.permissions, t));
|
|
146
|
-
}
|
|
147
|
-
function C(e) {
|
|
148
|
-
return Array.isArray(e) ? e.filter((e) => !!(e && typeof e == "object")) : [];
|
|
149
|
-
}
|
|
150
|
-
function w(e) {
|
|
151
|
-
return e && typeof e == "object" && !Array.isArray(e) ? e : null;
|
|
152
|
-
}
|
|
153
|
-
function T(e, t) {
|
|
154
|
-
for (let n of t) {
|
|
155
|
-
let t = e[n];
|
|
156
|
-
if (typeof t == "string" && t) return t;
|
|
157
|
-
}
|
|
158
|
-
return "";
|
|
159
|
-
}
|
|
160
|
-
function E(e, t) {
|
|
161
|
-
for (let n of t) {
|
|
162
|
-
let t = e[n];
|
|
163
|
-
if (typeof t == "number") return t;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
//#endregion
|
|
167
|
-
//#region src/main/api/auth.ts
|
|
168
|
-
async function D(e) {
|
|
169
|
-
return await Promise.resolve(m(e.username));
|
|
170
|
-
}
|
|
171
|
-
async function O() {
|
|
172
|
-
await Promise.resolve();
|
|
173
|
-
}
|
|
174
|
-
async function k() {
|
|
175
|
-
return await Promise.resolve(h());
|
|
176
|
-
}
|
|
177
|
-
//#endregion
|
|
178
|
-
//#region src/main/stores/auth.ts
|
|
179
|
-
var A = "auth-user", j = "auth-roles", M = "auth-permissions", N = {
|
|
180
|
-
id: "mock-admin",
|
|
181
|
-
name: "admin",
|
|
182
|
-
role: "admin",
|
|
183
|
-
roleLabel: "系统管理员"
|
|
184
|
-
}, P = u("auth", () => {
|
|
185
|
-
let u = l(n()), d = l(s(A, N)), f = l(s(j, h().roles)), p = l(s(M, h().permissions)), m = l(!1), g = c(() => !!u.value), _ = c(() => d.value.name || N.name), v = c(() => d.value.role || N.role), y = c(() => v.value === "admin" || f.value.some((e) => e.code === "admin") || p.value.includes("*")), b = c(() => d.value.roleLabel || (v.value === "admin" ? "系统管理员" : "业务用户"));
|
|
186
|
-
async function x() {
|
|
187
|
-
if (m.value) {
|
|
188
|
-
m.value = !0;
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
if (!u.value) {
|
|
192
|
-
m.value = !0;
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
let e = await k();
|
|
196
|
-
C({
|
|
197
|
-
token: u.value,
|
|
198
|
-
user: e.user,
|
|
199
|
-
roles: e.roles,
|
|
200
|
-
permissions: e.permissions
|
|
201
|
-
}), m.value = !0;
|
|
202
|
-
}
|
|
203
|
-
async function S(e) {
|
|
204
|
-
let t = await D({
|
|
205
|
-
username: e.username,
|
|
206
|
-
password: e.password ?? ""
|
|
207
|
-
});
|
|
208
|
-
C(t);
|
|
209
|
-
let n = await k();
|
|
210
|
-
return C({
|
|
211
|
-
token: t.token,
|
|
212
|
-
user: n.user,
|
|
213
|
-
roles: n.roles,
|
|
214
|
-
permissions: n.permissions
|
|
215
|
-
}), t;
|
|
216
|
-
}
|
|
217
|
-
function C(e) {
|
|
218
|
-
u.value = e.token, d.value = e.user || N, f.value = e.roles?.length ? e.roles : h().roles, p.value = e.permissions?.length ? e.permissions : h().permissions, r(u.value), i({
|
|
219
|
-
user: d.value,
|
|
220
|
-
roles: f.value,
|
|
221
|
-
permissions: p.value
|
|
222
|
-
}), o(A, d.value), o(j, f.value), o(M, p.value);
|
|
223
|
-
}
|
|
224
|
-
async function w() {
|
|
225
|
-
await O(), u.value = "", d.value = N, f.value = h().roles, p.value = h().permissions, m.value = !1, e(), t(), a(A), a(j), a(M);
|
|
226
|
-
}
|
|
227
|
-
function T(e) {
|
|
228
|
-
return !e || y.value ? !0 : p.value.includes(e);
|
|
229
|
-
}
|
|
230
|
-
return {
|
|
231
|
-
initAuth: x,
|
|
232
|
-
isAuthenticated: g,
|
|
233
|
-
login: S,
|
|
234
|
-
logout: w,
|
|
235
|
-
hasPermission: T,
|
|
236
|
-
initialized: m,
|
|
237
|
-
isSuperAdmin: y,
|
|
238
|
-
permissions: p,
|
|
239
|
-
roles: f,
|
|
240
|
-
token: u,
|
|
241
|
-
user: d,
|
|
242
|
-
userName: _,
|
|
243
|
-
userRole: v,
|
|
244
|
-
userRoleLabel: b
|
|
245
|
-
};
|
|
246
|
-
});
|
|
247
|
-
//#endregion
|
|
248
|
-
export { _ as a, g as i, m as n, h as r, P as t };
|