sumor 3.1.7 → 3.1.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/web/UrlHelper.js +1 -1
- package/dist/web/api/hasPermission.js +1 -1
- package/dist/web/api/hasRole.js +1 -1
- package/dist/web/api/login.js +1 -1
- package/dist/web/api/logout.js +2 -2
- package/dist/web/api/refreshToken.js +2 -2
- package/dist/web/axiosInstance.js +1 -1
- package/dist/web/index.js +8 -8
- package/package.json +3 -3
package/dist/web/UrlHelper.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - hasPermission('posts', 'edit') 检查是否有 'posts:edit' 权限
|
|
9
9
|
* - hasPermission('posts', '*') 或 hasPermission('posts') 检查是否有任何 posts 权限
|
|
10
10
|
*/
|
|
11
|
-
import { oauthStore } from '../OAuthStore';
|
|
11
|
+
import { oauthStore } from '../OAuthStore.js';
|
|
12
12
|
export default function hasPermission(module, operation = '*') {
|
|
13
13
|
const user = oauthStore.getUser();
|
|
14
14
|
if (!user || !user.permissions) {
|
package/dist/web/api/hasRole.js
CHANGED
package/dist/web/api/login.js
CHANGED
package/dist/web/api/logout.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 登出:调用后端登出接口,撤销会话
|
|
3
3
|
*/
|
|
4
|
-
import { oauthStore } from '../OAuthStore';
|
|
5
|
-
import { axiosInstance } from '../axiosInstance';
|
|
4
|
+
import { oauthStore } from '../OAuthStore.js';
|
|
5
|
+
import { axiosInstance } from '../axiosInstance.js';
|
|
6
6
|
export default async function logout() {
|
|
7
7
|
try {
|
|
8
8
|
await axiosInstance.post('/api/oauth/logout', {}, { withCredentials: true });
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* 通过刷新 access token 接口获取 endpoint、authorizeUrl 和用户信息
|
|
4
4
|
* @param force 是否强制刷新,忽略缓存
|
|
5
5
|
*/
|
|
6
|
-
import { oauthStore } from '../OAuthStore';
|
|
7
|
-
import { axiosInstance } from '../axiosInstance';
|
|
6
|
+
import { oauthStore } from '../OAuthStore.js';
|
|
7
|
+
import { axiosInstance } from '../axiosInstance.js';
|
|
8
8
|
const CACHE_TTL = 3600000; // 1小时,单位毫秒
|
|
9
9
|
export default async function refreshToken(force = false) {
|
|
10
10
|
// SSR 环境下不执行刷新
|
package/dist/web/index.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* Sumor Framework - 轻呈云客户端 API
|
|
3
3
|
*/
|
|
4
4
|
// 导出所有 API 函数
|
|
5
|
-
export { default as refreshToken } from './api/refreshToken';
|
|
6
|
-
export { default as login } from './api/login';
|
|
7
|
-
export { default as logout } from './api/logout';
|
|
8
|
-
export { default as hasPermission } from './api/hasPermission';
|
|
9
|
-
export { default as hasRole } from './api/hasRole';
|
|
5
|
+
export { default as refreshToken } from './api/refreshToken.js';
|
|
6
|
+
export { default as login } from './api/login.js';
|
|
7
|
+
export { default as logout } from './api/logout.js';
|
|
8
|
+
export { default as hasPermission } from './api/hasPermission.js';
|
|
9
|
+
export { default as hasRole } from './api/hasRole.js';
|
|
10
10
|
// 导出其他工具
|
|
11
|
-
export { oauthUrl } from './UrlHelper';
|
|
12
|
-
export { oauthStore } from './OAuthStore';
|
|
13
|
-
export { axiosInstance as axios } from './axiosInstance';
|
|
11
|
+
export { oauthUrl } from './UrlHelper.js';
|
|
12
|
+
export { oauthStore } from './OAuthStore.js';
|
|
13
|
+
export { axiosInstance as axios } from './axiosInstance.js';
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sumor",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.8",
|
|
4
4
|
"description": "Sumor OAuth framework",
|
|
5
5
|
"main": "dist/server/index.js",
|
|
6
6
|
"types": "dist/server/index.d.ts",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"scripts": {
|
|
28
28
|
"init": "npm install",
|
|
29
29
|
"build": "npm run build:server && npm run build:web",
|
|
30
|
-
"build:server": "tsc -p tsconfig.server.json && tsc-alias -p tsconfig.server.json",
|
|
31
|
-
"build:web": "tsc -p tsconfig.web.json && tsc-alias -p tsconfig.web.json",
|
|
30
|
+
"build:server": "tsc -p tsconfig.server.json && tsc-alias -p tsconfig.server.json && node scripts/add-extensions.js",
|
|
31
|
+
"build:web": "tsc -p tsconfig.web.json && tsc-alias -p tsconfig.web.json && node scripts/add-extensions.js",
|
|
32
32
|
"clean": "rm -rf dist",
|
|
33
33
|
"prebuild": "npm run clean",
|
|
34
34
|
"type-check": "tsc --noEmit",
|