@amaster.ai/auth-client 1.1.71 → 1.1.72

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/oauth.d.cts CHANGED
@@ -14,7 +14,7 @@
14
14
  * ============================================================================
15
15
  */
16
16
  import { HttpClient, ClientResult } from '@amaster.ai/http-client';
17
- import { O as OAuthBinding, n as OAuthProvider, w as SuccessResponse } from './types-okzoIgFt.cjs';
17
+ import { O as OAuthBinding, o as OAuthProvider, y as SuccessResponse } from './types-BD5m6HPr.cjs';
18
18
 
19
19
  /**
20
20
  * OAuth Module
package/dist/oauth.d.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  * ============================================================================
15
15
  */
16
16
  import { HttpClient, ClientResult } from '@amaster.ai/http-client';
17
- import { O as OAuthBinding, n as OAuthProvider, w as SuccessResponse } from './types-okzoIgFt.js';
17
+ import { O as OAuthBinding, o as OAuthProvider, y as SuccessResponse } from './types-BD5m6HPr.js';
18
18
 
19
19
  /**
20
20
  * OAuth Module
@@ -14,7 +14,7 @@
14
14
  * ============================================================================
15
15
  */
16
16
  import { HttpClient } from '@amaster.ai/http-client';
17
- import { x as User } from './types-okzoIgFt.cjs';
17
+ import { z as User } from './types-BD5m6HPr.cjs';
18
18
 
19
19
  /**
20
20
  * Permissions Module
@@ -14,7 +14,7 @@
14
14
  * ============================================================================
15
15
  */
16
16
  import { HttpClient } from '@amaster.ai/http-client';
17
- import { x as User } from './types-okzoIgFt.js';
17
+ import { z as User } from './types-BD5m6HPr.js';
18
18
 
19
19
  /**
20
20
  * Permissions Module
@@ -14,7 +14,7 @@
14
14
  * ============================================================================
15
15
  */
16
16
  import { HttpClient, ClientResult } from '@amaster.ai/http-client';
17
- import { v as Session, w as SuccessResponse, r as RevokeAllSessionsResponse } from './types-okzoIgFt.cjs';
17
+ import { x as Session, y as SuccessResponse, s as RevokeAllSessionsResponse } from './types-BD5m6HPr.cjs';
18
18
 
19
19
  /**
20
20
  * Sessions Module
@@ -14,7 +14,7 @@
14
14
  * ============================================================================
15
15
  */
16
16
  import { HttpClient, ClientResult } from '@amaster.ai/http-client';
17
- import { v as Session, w as SuccessResponse, r as RevokeAllSessionsResponse } from './types-okzoIgFt.js';
17
+ import { x as Session, y as SuccessResponse, s as RevokeAllSessionsResponse } from './types-BD5m6HPr.js';
18
18
 
19
19
  /**
20
20
  * Sessions Module
@@ -15,6 +15,23 @@
15
15
  */
16
16
  import { MiniProgramRuntime } from '@amaster.ai/http-client';
17
17
 
18
+ /**
19
+ * Storage adapter for token and user data persistence
20
+ * Auto-detects environment and uses appropriate storage:
21
+ * - Browser: localStorage
22
+ * - WeChat Mini Program: wx.setStorageSync/wx.getStorageSync
23
+ * - Douyin Mini Program: `tt.setStorageSync` / `tt.getStorageSync`
24
+ * - SSR/Node.js: No-op (no persistence)
25
+ */
26
+ interface StorageAdapter {
27
+ getItem(key: string): string | null;
28
+ setItem(key: string, value: string): void;
29
+ removeItem(key: string): void;
30
+ clear(): void;
31
+ }
32
+ /** A separate instance per application; nothing is persisted in the host origin. */
33
+ declare function createMemoryStorage(): StorageAdapter;
34
+
18
35
  /**
19
36
  * Authentication SDK Types
20
37
  */
@@ -39,6 +56,10 @@ import { MiniProgramRuntime } from '@amaster.ai/http-client';
39
56
  *
40
57
  */
41
58
  interface AuthClientOptions {
59
+ /** Isolated storage for embedded clients; omitted uses the existing runtime storage. */
60
+ storage?: StorageAdapter;
61
+ /** Include HttpOnly application-session cookies across origins. */
62
+ withCredentials?: boolean;
42
63
  /** Disable when a trusted host manages access-token renewal externally. Defaults to true. */
43
64
  autoRefresh?: boolean;
44
65
  /**
@@ -98,6 +119,12 @@ interface AuthClientOptions {
98
119
  */
99
120
  runtime?: Partial<MiniProgramRuntime>;
100
121
  }
122
+ /** Explicit browser settings select the extended client overload. */
123
+ type BrowserAuthClientOptions = AuthClientOptions & ({
124
+ storage: StorageAdapter;
125
+ } | {
126
+ withCredentials: boolean;
127
+ });
101
128
  /**
102
129
  * User information with roles and permissions
103
130
  *
@@ -604,4 +631,4 @@ interface DepartmentPosition {
604
631
  description?: string;
605
632
  }
606
633
 
607
- export type { AuthClientOptions as A, ChangePasswordParams as C, DepartmentPosition as D, EventHandler as E, FeishuPublicConfig as F, LoginParams as L, MiniGetPhoneEvent as M, OAuthBinding as O, Permission as P, RefreshTokenResponse as R, SendCodeParams as S, UpdateMeParams as U, AuthEvent as a, CaptchaResponse as b, CodeLoginParams as c, CodeLoginType as d, LoginResponse as e, LoginType as f, MiniGetPhoneParams as g, MiniLoginParams as h, MiniProgramLoginParams as i, MiniProgramPlatform as j, MiniProgramPhoneParams as k, MiniProgramPhoneResponse as l, OAuthLoginTicketResponse as m, OAuthProvider as n, PermissionDetail as o, RegisterParams as p, RegisterResponse as q, RevokeAllSessionsResponse as r, Role as s, RoleDetail as t, SendCodeType as u, Session as v, SuccessResponse as w, User as x };
634
+ export { type AuthEvent as A, type BrowserAuthClientOptions as B, type ChangePasswordParams as C, type DepartmentPosition as D, type EventHandler as E, type FeishuPublicConfig as F, type LoginResponse as L, type MiniGetPhoneEvent as M, type OAuthBinding as O, type Permission as P, type RefreshTokenResponse as R, type StorageAdapter as S, type UpdateMeParams as U, type AuthClientOptions as a, type CaptchaResponse as b, createMemoryStorage as c, type CodeLoginParams as d, type CodeLoginType as e, type LoginParams as f, type LoginType as g, type MiniGetPhoneParams as h, type MiniLoginParams as i, type MiniProgramLoginParams as j, type MiniProgramPlatform as k, type MiniProgramPhoneParams as l, type MiniProgramPhoneResponse as m, type OAuthLoginTicketResponse as n, type OAuthProvider as o, type PermissionDetail as p, type RegisterParams as q, type RegisterResponse as r, type RevokeAllSessionsResponse as s, type Role as t, type RoleDetail as u, type SendCodeParams as v, type SendCodeType as w, type Session as x, type SuccessResponse as y, type User as z };
@@ -15,6 +15,23 @@
15
15
  */
16
16
  import { MiniProgramRuntime } from '@amaster.ai/http-client';
17
17
 
18
+ /**
19
+ * Storage adapter for token and user data persistence
20
+ * Auto-detects environment and uses appropriate storage:
21
+ * - Browser: localStorage
22
+ * - WeChat Mini Program: wx.setStorageSync/wx.getStorageSync
23
+ * - Douyin Mini Program: `tt.setStorageSync` / `tt.getStorageSync`
24
+ * - SSR/Node.js: No-op (no persistence)
25
+ */
26
+ interface StorageAdapter {
27
+ getItem(key: string): string | null;
28
+ setItem(key: string, value: string): void;
29
+ removeItem(key: string): void;
30
+ clear(): void;
31
+ }
32
+ /** A separate instance per application; nothing is persisted in the host origin. */
33
+ declare function createMemoryStorage(): StorageAdapter;
34
+
18
35
  /**
19
36
  * Authentication SDK Types
20
37
  */
@@ -39,6 +56,10 @@ import { MiniProgramRuntime } from '@amaster.ai/http-client';
39
56
  *
40
57
  */
41
58
  interface AuthClientOptions {
59
+ /** Isolated storage for embedded clients; omitted uses the existing runtime storage. */
60
+ storage?: StorageAdapter;
61
+ /** Include HttpOnly application-session cookies across origins. */
62
+ withCredentials?: boolean;
42
63
  /** Disable when a trusted host manages access-token renewal externally. Defaults to true. */
43
64
  autoRefresh?: boolean;
44
65
  /**
@@ -98,6 +119,12 @@ interface AuthClientOptions {
98
119
  */
99
120
  runtime?: Partial<MiniProgramRuntime>;
100
121
  }
122
+ /** Explicit browser settings select the extended client overload. */
123
+ type BrowserAuthClientOptions = AuthClientOptions & ({
124
+ storage: StorageAdapter;
125
+ } | {
126
+ withCredentials: boolean;
127
+ });
101
128
  /**
102
129
  * User information with roles and permissions
103
130
  *
@@ -604,4 +631,4 @@ interface DepartmentPosition {
604
631
  description?: string;
605
632
  }
606
633
 
607
- export type { AuthClientOptions as A, ChangePasswordParams as C, DepartmentPosition as D, EventHandler as E, FeishuPublicConfig as F, LoginParams as L, MiniGetPhoneEvent as M, OAuthBinding as O, Permission as P, RefreshTokenResponse as R, SendCodeParams as S, UpdateMeParams as U, AuthEvent as a, CaptchaResponse as b, CodeLoginParams as c, CodeLoginType as d, LoginResponse as e, LoginType as f, MiniGetPhoneParams as g, MiniLoginParams as h, MiniProgramLoginParams as i, MiniProgramPlatform as j, MiniProgramPhoneParams as k, MiniProgramPhoneResponse as l, OAuthLoginTicketResponse as m, OAuthProvider as n, PermissionDetail as o, RegisterParams as p, RegisterResponse as q, RevokeAllSessionsResponse as r, Role as s, RoleDetail as t, SendCodeType as u, Session as v, SuccessResponse as w, User as x };
634
+ export { type AuthEvent as A, type BrowserAuthClientOptions as B, type ChangePasswordParams as C, type DepartmentPosition as D, type EventHandler as E, type FeishuPublicConfig as F, type LoginResponse as L, type MiniGetPhoneEvent as M, type OAuthBinding as O, type Permission as P, type RefreshTokenResponse as R, type StorageAdapter as S, type UpdateMeParams as U, type AuthClientOptions as a, type CaptchaResponse as b, createMemoryStorage as c, type CodeLoginParams as d, type CodeLoginType as e, type LoginParams as f, type LoginType as g, type MiniGetPhoneParams as h, type MiniLoginParams as i, type MiniProgramLoginParams as j, type MiniProgramPlatform as k, type MiniProgramPhoneParams as l, type MiniProgramPhoneResponse as m, type OAuthLoginTicketResponse as n, type OAuthProvider as o, type PermissionDetail as p, type RegisterParams as q, type RegisterResponse as r, type RevokeAllSessionsResponse as s, type Role as t, type RoleDetail as u, type SendCodeParams as v, type SendCodeType as w, type Session as x, type SuccessResponse as y, type User as z };
package/dist/user.d.cts CHANGED
@@ -14,7 +14,7 @@
14
14
  * ============================================================================
15
15
  */
16
16
  import { HttpClient, ClientResult } from '@amaster.ai/http-client';
17
- import { x as User, U as UpdateMeParams, C as ChangePasswordParams, w as SuccessResponse } from './types-okzoIgFt.cjs';
17
+ import { z as User, U as UpdateMeParams, C as ChangePasswordParams, y as SuccessResponse } from './types-BD5m6HPr.cjs';
18
18
 
19
19
  /**
20
20
  * User Management Module
@@ -35,6 +35,7 @@ interface UserModuleDeps {
35
35
  setItem: (key: string, value: string) => void;
36
36
  };
37
37
  onUserUpdate: (user: User) => void;
38
+ getAuthVersion?: () => number | undefined;
38
39
  onAuthFailure?: (result: ClientResult<User>) => void;
39
40
  }
40
41
  declare function createUserModule(deps: UserModuleDeps): {
package/dist/user.d.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  * ============================================================================
15
15
  */
16
16
  import { HttpClient, ClientResult } from '@amaster.ai/http-client';
17
- import { x as User, U as UpdateMeParams, C as ChangePasswordParams, w as SuccessResponse } from './types-okzoIgFt.js';
17
+ import { z as User, U as UpdateMeParams, C as ChangePasswordParams, y as SuccessResponse } from './types-BD5m6HPr.js';
18
18
 
19
19
  /**
20
20
  * User Management Module
@@ -35,6 +35,7 @@ interface UserModuleDeps {
35
35
  setItem: (key: string, value: string) => void;
36
36
  };
37
37
  onUserUpdate: (user: User) => void;
38
+ getAuthVersion?: () => number | undefined;
38
39
  onAuthFailure?: (result: ClientResult<User>) => void;
39
40
  }
40
41
  declare function createUserModule(deps: UserModuleDeps): {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amaster.ai/auth-client",
3
- "version": "1.1.71",
3
+ "version": "1.1.72",
4
4
  "description": "Authentication SDK for Amaster platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -47,7 +47,7 @@
47
47
  "registry": "https://registry.npmjs.org/"
48
48
  },
49
49
  "dependencies": {
50
- "@amaster.ai/http-client": "1.1.71"
50
+ "@amaster.ai/http-client": "1.1.72"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "axios": "^1.11.0"