@e-xi/xion 0.0.25 → 0.0.27

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.
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-P4CX6I4J.js";
7
7
 
8
8
  // package.json
9
- var version = "0.0.25";
9
+ var version = "0.0.27";
10
10
 
11
11
  // src/main/banner/banner-abstract.ts
12
12
  var BannerAbstract = class {
@@ -44,7 +44,7 @@ import "../../chunk-files/chunk-J34MOWJP.js";
44
44
  import "../../chunk-files/chunk-RSUM4GBD.js";
45
45
  import {
46
46
  BannerManager
47
- } from "../../chunk-files/chunk-5UTMFRI6.js";
47
+ } from "../../chunk-files/chunk-CZF5FXD4.js";
48
48
  import "../../chunk-files/chunk-YLZRRUY7.js";
49
49
  import {
50
50
  defineAppConfig,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  BannerAbstract,
3
3
  BannerManager
4
- } from "../../chunk-files/chunk-5UTMFRI6.js";
4
+ } from "../../chunk-files/chunk-CZF5FXD4.js";
5
5
  import "../../chunk-files/chunk-YLZRRUY7.js";
6
6
  import "../../chunk-files/chunk-P4CX6I4J.js";
7
7
  export {
@@ -1,35 +1,62 @@
1
- import { type ComputedRef, type Ref } from 'vue';
1
+ import { type Pinia } from 'pinia';
2
2
  /**
3
- * JWT 认证 Store 的 setup 返回类型
3
+ * JWT 认证 Store
4
4
  */
5
- interface AuthStoreSetup {
6
- /** 当前认证状态 */
7
- status: Ref<XoAuth.Status>;
8
- /** 当前登录用户 */
9
- user: Ref<XoAuth.User | undefined>;
10
- /** 最近一次认证错误信息 */
11
- error: Ref<string | undefined>;
12
- /** 是否正在初始化 */
13
- isInitializing: ComputedRef<boolean>;
14
- /** 是否正在登录 */
15
- isAuthenticating: ComputedRef<boolean>;
16
- /** 是否正在刷新 */
17
- isRefreshing: ComputedRef<boolean>;
18
- /** 是否已登录 */
19
- isAuthenticated: ComputedRef<boolean>;
20
- /** 是否未登录 */
21
- isUnauthenticated: ComputedRef<boolean>;
22
- /** 是否认证异常 */
23
- isError: ComputedRef<boolean>;
24
- /** 初始化认证状态与监听器 */
5
+ declare const useXoAuthStoreDefinition: import("pinia").StoreDefinition<"useXoAuthStore", Pick<{
6
+ status: import("vue").Ref<"error" | "unauthenticated" | "initializing" | "authenticating" | "refreshing" | "authenticated", "error" | "unauthenticated" | "initializing" | "authenticating" | "refreshing" | "authenticated">;
7
+ user: import("vue").Ref<unknown, unknown>;
8
+ error: import("vue").Ref<string | undefined, string | undefined>;
9
+ isInitializing: import("vue").ComputedRef<boolean>;
10
+ isAuthenticating: import("vue").ComputedRef<boolean>;
11
+ isRefreshing: import("vue").ComputedRef<boolean>;
12
+ isAuthenticated: import("vue").ComputedRef<boolean>;
13
+ isUnauthenticated: import("vue").ComputedRef<boolean>;
14
+ isError: import("vue").ComputedRef<boolean>;
15
+ initialize: () => Promise<void>;
16
+ login: (request: XoAuth.LoginRequest) => Promise<void>;
17
+ logout: () => Promise<void>;
18
+ }, "error" | "status" | "user">, Pick<{
19
+ status: import("vue").Ref<"error" | "unauthenticated" | "initializing" | "authenticating" | "refreshing" | "authenticated", "error" | "unauthenticated" | "initializing" | "authenticating" | "refreshing" | "authenticated">;
20
+ user: import("vue").Ref<unknown, unknown>;
21
+ error: import("vue").Ref<string | undefined, string | undefined>;
22
+ isInitializing: import("vue").ComputedRef<boolean>;
23
+ isAuthenticating: import("vue").ComputedRef<boolean>;
24
+ isRefreshing: import("vue").ComputedRef<boolean>;
25
+ isAuthenticated: import("vue").ComputedRef<boolean>;
26
+ isUnauthenticated: import("vue").ComputedRef<boolean>;
27
+ isError: import("vue").ComputedRef<boolean>;
28
+ initialize: () => Promise<void>;
29
+ login: (request: XoAuth.LoginRequest) => Promise<void>;
30
+ logout: () => Promise<void>;
31
+ }, "isInitializing" | "isAuthenticating" | "isRefreshing" | "isAuthenticated" | "isUnauthenticated" | "isError">, Pick<{
32
+ status: import("vue").Ref<"error" | "unauthenticated" | "initializing" | "authenticating" | "refreshing" | "authenticated", "error" | "unauthenticated" | "initializing" | "authenticating" | "refreshing" | "authenticated">;
33
+ user: import("vue").Ref<unknown, unknown>;
34
+ error: import("vue").Ref<string | undefined, string | undefined>;
35
+ isInitializing: import("vue").ComputedRef<boolean>;
36
+ isAuthenticating: import("vue").ComputedRef<boolean>;
37
+ isRefreshing: import("vue").ComputedRef<boolean>;
38
+ isAuthenticated: import("vue").ComputedRef<boolean>;
39
+ isUnauthenticated: import("vue").ComputedRef<boolean>;
40
+ isError: import("vue").ComputedRef<boolean>;
25
41
  initialize: () => Promise<void>;
26
- /** 登录 */
27
42
  login: (request: XoAuth.LoginRequest) => Promise<void>;
28
- /** 退出登录 */
29
43
  logout: () => Promise<void>;
30
- }
44
+ }, "login" | "logout" | "initialize">>;
31
45
  /**
32
- * JWT 认证 Store
46
+ * 认证 Store 实例类型
47
+ * @template TUser 业务端指定的登录用户类型
48
+ */
49
+ export type XoAuthStore<TUser = XoAuth.User> = Omit<ReturnType<typeof useXoAuthStoreDefinition>, 'user'> & {
50
+ /** 当前登录用户 */
51
+ user: TUser | undefined;
52
+ };
53
+ /**
54
+ * 获取认证 Store 实例
55
+ * @template TUser 业务端指定的登录用户类型
56
+ * @param {Pinia | null | undefined} pinia Pinia 实例
57
+ * @returns {XoAuthStore<TUser>} 认证 Store 实例
58
+ * @example
59
+ * const authStore = useXoAuthStore<User>()
33
60
  */
34
- export declare const useXoAuthStore: import("pinia").StoreDefinition<"useXoAuthStore", Pick<AuthStoreSetup, "error" | "status" | "user">, Pick<AuthStoreSetup, "isInitializing" | "isAuthenticating" | "isRefreshing" | "isAuthenticated" | "isUnauthenticated" | "isError">, Pick<AuthStoreSetup, "login" | "logout" | "initialize">>;
61
+ export declare function useXoAuthStore<TUser = XoAuth.User>(pinia?: Pinia | null): XoAuthStore<TUser>;
35
62
  export {};
@@ -69,7 +69,7 @@ var useXoAppStore = defineStore("useXoAppStore", () => {
69
69
  // src/renderer/store/auth/auth-store.ts
70
70
  import { defineStore as defineStore2 } from "pinia";
71
71
  import { computed as computed2, ref as ref2, shallowRef } from "vue";
72
- var useXoAuthStore = defineStore2("useXoAuthStore", () => {
72
+ var useXoAuthStoreDefinition = defineStore2("useXoAuthStore", () => {
73
73
  const initializePromise = shallowRef();
74
74
  const offState = shallowRef();
75
75
  const status = ref2("initializing");
@@ -135,6 +135,9 @@ var useXoAuthStore = defineStore2("useXoAuthStore", () => {
135
135
  logout
136
136
  };
137
137
  });
138
+ function useXoAuthStore(pinia) {
139
+ return useXoAuthStoreDefinition(pinia);
140
+ }
138
141
 
139
142
  // src/shared/remote-service/const/remote-service.ts
140
143
  var RemoteServiceStatusOptions = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-xi/xion",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "type": "module",
5
5
  "description": "Electron Vite Vue3 TypeScript framework.",
6
6
  "exports": {