@pubinfo-nightly/module-auth 2026.1.18 → 2026.1.20

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.
@@ -1,7 +1,7 @@
1
1
  import type { RouteLocationRaw } from 'vue-router';
2
2
  export type Recordable = Record<string, any>;
3
3
  export type Fn<T = any, K = any> = (params?: Recordable & T) => Promise<K> | K;
4
- export type FnApi<T = any> = (params: Recordable & T, baseURL: string) => Promise<any>;
4
+ export type FnApi<T = any, R = any> = (params: Recordable & T, baseURL: string) => Promise<R>;
5
5
  export interface AuthOptions {
6
6
  /** 登录后默认重定向至 */
7
7
  redirectTo?: RouteLocationRaw | Fn;
@@ -37,7 +37,7 @@ export interface ProviderOptions {
37
37
  /** 授权登录地址 */
38
38
  signIn?: Authorization | Fn;
39
39
  /** 授权登录接口 */
40
- authenticate?: string | FnApi;
40
+ authenticate?: string | FnApi<any, LoginResponse>;
41
41
  /** 初始化二维码 */
42
42
  initQRCode?: (url: string, params: {
43
43
  id: string;
@@ -49,3 +49,12 @@ export interface Authorization {
49
49
  /** 授权登录参数 */
50
50
  params?: Recordable;
51
51
  }
52
+ export interface LoginResponse {
53
+ success?: boolean;
54
+ data: {
55
+ accessToken: string;
56
+ refreshToken: string;
57
+ [key: string]: any;
58
+ };
59
+ msg?: string;
60
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pubinfo-nightly/module-auth",
3
3
  "type": "module",
4
- "version": "2026.01.18",
4
+ "version": "2026.01.20",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -23,10 +23,10 @@
23
23
  "node": "^20.19.0 || >=22.12.0"
24
24
  },
25
25
  "peerDependencies": {
26
- "pubinfo-nightly": "2026.01.18"
26
+ "pubinfo-nightly": "2026.01.20"
27
27
  },
28
28
  "devDependencies": {
29
- "pubinfo-nightly": "2026.01.18"
29
+ "pubinfo-nightly": "2026.01.20"
30
30
  },
31
31
  "scripts": {
32
32
  "dev": "pubinfo build --watch",
package/src/interface.ts CHANGED
@@ -2,7 +2,7 @@ import type { RouteLocationRaw } from 'vue-router';
2
2
 
3
3
  export type Recordable = Record<string, any>;
4
4
  export type Fn<T = any, K = any> = (params?: Recordable & T) => Promise<K> | K;
5
- export type FnApi<T = any> = (params: Recordable & T, baseURL: string) => Promise<any>;
5
+ export type FnApi<T = any, R = any> = (params: Recordable & T, baseURL: string) => Promise<R>;
6
6
 
7
7
  export interface AuthOptions {
8
8
  /** 登录后默认重定向至 */
@@ -50,7 +50,7 @@ export interface ProviderOptions {
50
50
  signIn?: Authorization | Fn
51
51
 
52
52
  /** 授权登录接口 */
53
- authenticate?: string | FnApi
53
+ authenticate?: string | FnApi<any, LoginResponse>
54
54
 
55
55
  /** 初始化二维码 */
56
56
  initQRCode?: (url: string, params: { id: string } & Recordable) => Promise<void> | void
@@ -63,3 +63,13 @@ export interface Authorization {
63
63
  /** 授权登录参数 */
64
64
  params?: Recordable
65
65
  }
66
+
67
+ export interface LoginResponse {
68
+ success?: boolean
69
+ data: {
70
+ accessToken: string
71
+ refreshToken: string
72
+ [key: string]: any
73
+ }
74
+ msg?: string
75
+ }