@blocklet/js-sdk 1.16.42-beta-20250412-084444-20b0cf19 → 1.16.42-beta-20250415-222652-04c5d2fe

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/index.d.mts CHANGED
@@ -64,13 +64,14 @@ declare class AuthService {
64
64
  spaceGateway: SpaceGateway;
65
65
  }): Promise<void>;
66
66
  /**
67
- *
68
67
  * 指定要退出登录的设备 id
69
- * @param {{ visitorId: string }} { visitorId }
68
+ * 指定要退出登录的会话状态
69
+ * @param {{ visitorId: string, status: string }} { visitorId, status }
70
70
  * @return {Promise<void>}
71
71
  */
72
- logout({ visitorId }: {
73
- visitorId: string;
72
+ logout({ visitorId, status }: {
73
+ visitorId?: string;
74
+ status?: string;
74
75
  }): Promise<void>;
75
76
  /**
76
77
  * 删除当前登录用户
@@ -196,6 +197,19 @@ type UserSession = {
196
197
  userDid: string;
197
198
  visitorId: string;
198
199
  };
200
+ type UserSessionList = {
201
+ list: UserSession[];
202
+ paging: {
203
+ page: number;
204
+ pageSize: number;
205
+ total: number;
206
+ };
207
+ };
208
+ type UserSessionQuery = {
209
+ page: number;
210
+ pageSize: number;
211
+ status?: 'online' | 'expired';
212
+ };
199
213
  declare class UserSessionService {
200
214
  private api;
201
215
  private blocklet;
@@ -213,7 +227,7 @@ declare class UserSessionService {
213
227
  */
214
228
  getMyLoginSessions({ appUrl }?: {
215
229
  appUrl?: string;
216
- }): Promise<UserSession[]>;
230
+ }, params?: UserSessionQuery): Promise<UserSessionList>;
217
231
  loginByUserSession({ id, appPid, userDid, passportId, appUrl, }: {
218
232
  appPid: string;
219
233
  userDid: string;
@@ -297,4 +311,4 @@ declare function createFetch(options?: RequestInit, requestParams?: RequestParam
297
311
  }) => Promise<Response>;
298
312
  declare const getBlockletSDK: () => BlockletSDK;
299
313
 
300
- export { AuthService, BlockletSDK, BlockletService, ComponentService, FederatedService, type NotificationConfig, type PrivacyConfig, type SpaceGateway, TokenService, type UserPublicInfo, type UserSession, UserSessionService, type UserSessionUser, type Webhook, createAxios, createFetch, getBlockletSDK, getCSRFToken };
314
+ export { AuthService, BlockletSDK, BlockletService, ComponentService, FederatedService, type NotificationConfig, type PrivacyConfig, type SpaceGateway, TokenService, type UserPublicInfo, type UserSession, type UserSessionList, type UserSessionQuery, UserSessionService, type UserSessionUser, type Webhook, createAxios, createFetch, getBlockletSDK, getCSRFToken };
package/dist/index.d.ts CHANGED
@@ -64,13 +64,14 @@ declare class AuthService {
64
64
  spaceGateway: SpaceGateway;
65
65
  }): Promise<void>;
66
66
  /**
67
- *
68
67
  * 指定要退出登录的设备 id
69
- * @param {{ visitorId: string }} { visitorId }
68
+ * 指定要退出登录的会话状态
69
+ * @param {{ visitorId: string, status: string }} { visitorId, status }
70
70
  * @return {Promise<void>}
71
71
  */
72
- logout({ visitorId }: {
73
- visitorId: string;
72
+ logout({ visitorId, status }: {
73
+ visitorId?: string;
74
+ status?: string;
74
75
  }): Promise<void>;
75
76
  /**
76
77
  * 删除当前登录用户
@@ -196,6 +197,19 @@ type UserSession = {
196
197
  userDid: string;
197
198
  visitorId: string;
198
199
  };
200
+ type UserSessionList = {
201
+ list: UserSession[];
202
+ paging: {
203
+ page: number;
204
+ pageSize: number;
205
+ total: number;
206
+ };
207
+ };
208
+ type UserSessionQuery = {
209
+ page: number;
210
+ pageSize: number;
211
+ status?: 'online' | 'expired';
212
+ };
199
213
  declare class UserSessionService {
200
214
  private api;
201
215
  private blocklet;
@@ -213,7 +227,7 @@ declare class UserSessionService {
213
227
  */
214
228
  getMyLoginSessions({ appUrl }?: {
215
229
  appUrl?: string;
216
- }): Promise<UserSession[]>;
230
+ }, params?: UserSessionQuery): Promise<UserSessionList>;
217
231
  loginByUserSession({ id, appPid, userDid, passportId, appUrl, }: {
218
232
  appPid: string;
219
233
  userDid: string;
@@ -297,4 +311,4 @@ declare function createFetch(options?: RequestInit, requestParams?: RequestParam
297
311
  }) => Promise<Response>;
298
312
  declare const getBlockletSDK: () => BlockletSDK;
299
313
 
300
- export { AuthService, BlockletSDK, BlockletService, ComponentService, FederatedService, type NotificationConfig, type PrivacyConfig, type SpaceGateway, TokenService, type UserPublicInfo, type UserSession, UserSessionService, type UserSessionUser, type Webhook, createAxios, createFetch, getBlockletSDK, getCSRFToken };
314
+ export { AuthService, BlockletSDK, BlockletService, ComponentService, FederatedService, type NotificationConfig, type PrivacyConfig, type SpaceGateway, TokenService, type UserPublicInfo, type UserSession, type UserSessionList, type UserSessionQuery, UserSessionService, type UserSessionUser, type Webhook, createAxios, createFetch, getBlockletSDK, getCSRFToken };
package/dist/index.mjs CHANGED
@@ -78,13 +78,13 @@ class AuthService {
78
78
  await this.api.put("/api/user/updateDidSpace", { spaceGateway });
79
79
  }
80
80
  /**
81
- *
82
81
  * 指定要退出登录的设备 id
83
- * @param {{ visitorId: string }} { visitorId }
82
+ * 指定要退出登录的会话状态
83
+ * @param {{ visitorId: string, status: string }} { visitorId, status }
84
84
  * @return {Promise<void>}
85
85
  */
86
- async logout({ visitorId }) {
87
- const { data } = await this.api.post("/api/user/logout", { visitorId });
86
+ async logout({ visitorId, status }) {
87
+ const { data } = await this.api.post("/api/user/logout", { visitorId, status });
88
88
  return data;
89
89
  }
90
90
  /**
@@ -212,9 +212,9 @@ class UserSessionService {
212
212
  /**
213
213
  * 获取个人的所有登录会话
214
214
  */
215
- async getMyLoginSessions({ appUrl } = {}) {
215
+ async getMyLoginSessions({ appUrl } = {}, params = { page: 1, pageSize: 10 }) {
216
216
  const baseURL = this.getBaseUrl(appUrl);
217
- const { data } = await this.api.get("/api/user-session/myself", { baseURL });
217
+ const { data } = await this.api.get("/api/user-session/myself", { baseURL, params });
218
218
  return data;
219
219
  }
220
220
  async loginByUserSession({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/js-sdk",
3
- "version": "1.16.42-beta-20250412-084444-20b0cf19",
3
+ "version": "1.16.42-beta-20250415-222652-04c5d2fe",
4
4
  "main": "dist/index.mjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -38,10 +38,10 @@
38
38
  "watch": "nodemon -w src -e ts -x 'npm run build'"
39
39
  },
40
40
  "dependencies": {
41
- "@abtnode/constant": "1.16.42-beta-20250412-084444-20b0cf19",
42
- "@arcblock/did": "1.19.19",
43
- "@blocklet/meta": "1.16.42-beta-20250412-084444-20b0cf19",
44
- "@ocap/wallet": "1.19.19",
41
+ "@abtnode/constant": "1.16.42-beta-20250415-222652-04c5d2fe",
42
+ "@arcblock/did": "1.19.20",
43
+ "@blocklet/meta": "1.16.42-beta-20250415-222652-04c5d2fe",
44
+ "@ocap/wallet": "1.19.20",
45
45
  "axios": "^1.7.9",
46
46
  "is-url": "^1.2.4",
47
47
  "js-cookie": "^3.0.5",
@@ -65,5 +65,5 @@
65
65
  "unbuild": "^2.0.0",
66
66
  "vitest": "^2.0.5"
67
67
  },
68
- "gitHead": "39162da666c4968344db44fc26c0b76bdf6193db"
68
+ "gitHead": "4458b1e7e92d62d93c70de7f636a0f6ae9a59f26"
69
69
  }