@amaster.ai/auth-client 1.1.72 → 1.1.74
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/README.md +28 -0
- package/dist/auth.d.cts +8 -3
- package/dist/auth.d.ts +8 -3
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +74 -8
- package/dist/index.d.ts +74 -8
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/oauth.d.cts +1 -1
- package/dist/oauth.d.ts +1 -1
- package/dist/permissions.d.cts +3 -3
- package/dist/permissions.d.ts +3 -3
- package/dist/rbac.cjs +3 -0
- package/dist/rbac.cjs.map +1 -0
- package/dist/rbac.d.cts +552 -0
- package/dist/rbac.d.ts +552 -0
- package/dist/rbac.js +3 -0
- package/dist/rbac.js.map +1 -0
- package/dist/sessions.d.cts +1 -1
- package/dist/sessions.d.ts +1 -1
- package/dist/tenancy.cjs +2 -0
- package/dist/tenancy.cjs.map +1 -0
- package/dist/tenancy.d.cts +157 -0
- package/dist/tenancy.d.ts +157 -0
- package/dist/tenancy.js +2 -0
- package/dist/tenancy.js.map +1 -0
- package/dist/tenant-management.cjs +2 -0
- package/dist/tenant-management.cjs.map +1 -0
- package/dist/tenant-management.d.cts +167 -0
- package/dist/tenant-management.d.ts +167 -0
- package/dist/tenant-management.js +2 -0
- package/dist/tenant-management.js.map +1 -0
- package/dist/tenant-structure.d.cts +38 -0
- package/dist/tenant-structure.d.ts +38 -0
- package/dist/{types-BD5m6HPr.d.cts → types-D5c61dWd.d.cts} +25 -5
- package/dist/{types-BD5m6HPr.d.ts → types-D5c61dWd.d.ts} +25 -5
- package/dist/user.d.cts +2 -1
- package/dist/user.d.ts +2 -1
- package/package.json +17 -2
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* ============================================================================
|
|
15
15
|
*/
|
|
16
|
-
import { MiniProgramRuntime } from '@amaster.ai/http-client';
|
|
16
|
+
import { ClientResult, MiniProgramRuntime } from '@amaster.ai/http-client';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Storage adapter for token and user data persistence
|
|
@@ -31,6 +31,22 @@ interface StorageAdapter {
|
|
|
31
31
|
}
|
|
32
32
|
/** A separate instance per application; nothing is persisted in the host origin. */
|
|
33
33
|
declare function createMemoryStorage(): StorageAdapter;
|
|
34
|
+
/**
|
|
35
|
+
* Create a storage adapter that auto-detects environment
|
|
36
|
+
*
|
|
37
|
+
* @returns Storage adapter optimized for current environment
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const storage = createStorageAdapter();
|
|
42
|
+
*
|
|
43
|
+
* // Browser → uses localStorage
|
|
44
|
+
* // WeChat Mini Program → uses wx.setStorageSync
|
|
45
|
+
* // Douyin Mini Program -> uses tt.setStorageSync
|
|
46
|
+
* // SSR/Node.js → uses no-op (no persistence)
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
declare function createStorageAdapter(namespace?: string): StorageAdapter;
|
|
34
50
|
|
|
35
51
|
/**
|
|
36
52
|
* Authentication SDK Types
|
|
@@ -56,10 +72,14 @@ declare function createMemoryStorage(): StorageAdapter;
|
|
|
56
72
|
*
|
|
57
73
|
*/
|
|
58
74
|
interface AuthClientOptions {
|
|
59
|
-
/** Isolated storage for embedded clients; omitted uses the existing runtime storage. */
|
|
60
75
|
storage?: StorageAdapter;
|
|
61
|
-
/** Include HttpOnly application-session cookies across origins. */
|
|
62
76
|
withCredentials?: boolean;
|
|
77
|
+
/** Isolate credentials by consumer application/environment. No legacy-key fallback. */
|
|
78
|
+
storageNamespace?: string;
|
|
79
|
+
/** A host using a separate authoritative account protocol can own initialization. */
|
|
80
|
+
syncUserOnInit?: boolean;
|
|
81
|
+
/** Verify consumer identity before committing a refreshed credential. */
|
|
82
|
+
verifyRefresh?: (accessToken: string) => Promise<ClientResult<unknown>>;
|
|
63
83
|
/** Disable when a trusted host manages access-token renewal externally. Defaults to true. */
|
|
64
84
|
autoRefresh?: boolean;
|
|
65
85
|
/**
|
|
@@ -588,7 +608,7 @@ interface Session {
|
|
|
588
608
|
/** Whether this is the current session */
|
|
589
609
|
isCurrent: boolean;
|
|
590
610
|
}
|
|
591
|
-
type AuthEvent = "login" | "logout" | "tokenExpired" | "tokenRefreshed" | "unauthorized";
|
|
611
|
+
type AuthEvent = "credentialsChanged" | "login" | "logout" | "tokenExpired" | "tokenRefreshed" | "unauthorized";
|
|
592
612
|
type EventHandler = (...args: any[]) => void;
|
|
593
613
|
/**
|
|
594
614
|
* Standard success response from backend
|
|
@@ -631,4 +651,4 @@ interface DepartmentPosition {
|
|
|
631
651
|
description?: string;
|
|
632
652
|
}
|
|
633
653
|
|
|
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
|
|
654
|
+
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, createStorageAdapter as G, 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 User as U, type AuthClientOptions as a, type CaptchaResponse as b, type CodeLoginParams as c, type CodeLoginType as d, type LoginParams as e, type LoginType as f, type MiniGetPhoneParams as g, type MiniLoginParams as h, type MiniProgramLoginParams as i, type MiniProgramPlatform as j, type MiniProgramPhoneParams as k, type MiniProgramPhoneResponse as l, type OAuthLoginTicketResponse as m, type OAuthProvider as n, type PermissionDetail as o, type RegisterParams as p, type RegisterResponse as q, type RevokeAllSessionsResponse as r, type Role as s, type RoleDetail as t, type SendCodeParams as u, type SendCodeType as v, type Session as w, type SuccessResponse as x, type UpdateMeParams as y, createMemoryStorage as z };
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* ============================================================================
|
|
15
15
|
*/
|
|
16
|
-
import { MiniProgramRuntime } from '@amaster.ai/http-client';
|
|
16
|
+
import { ClientResult, MiniProgramRuntime } from '@amaster.ai/http-client';
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Storage adapter for token and user data persistence
|
|
@@ -31,6 +31,22 @@ interface StorageAdapter {
|
|
|
31
31
|
}
|
|
32
32
|
/** A separate instance per application; nothing is persisted in the host origin. */
|
|
33
33
|
declare function createMemoryStorage(): StorageAdapter;
|
|
34
|
+
/**
|
|
35
|
+
* Create a storage adapter that auto-detects environment
|
|
36
|
+
*
|
|
37
|
+
* @returns Storage adapter optimized for current environment
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const storage = createStorageAdapter();
|
|
42
|
+
*
|
|
43
|
+
* // Browser → uses localStorage
|
|
44
|
+
* // WeChat Mini Program → uses wx.setStorageSync
|
|
45
|
+
* // Douyin Mini Program -> uses tt.setStorageSync
|
|
46
|
+
* // SSR/Node.js → uses no-op (no persistence)
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
declare function createStorageAdapter(namespace?: string): StorageAdapter;
|
|
34
50
|
|
|
35
51
|
/**
|
|
36
52
|
* Authentication SDK Types
|
|
@@ -56,10 +72,14 @@ declare function createMemoryStorage(): StorageAdapter;
|
|
|
56
72
|
*
|
|
57
73
|
*/
|
|
58
74
|
interface AuthClientOptions {
|
|
59
|
-
/** Isolated storage for embedded clients; omitted uses the existing runtime storage. */
|
|
60
75
|
storage?: StorageAdapter;
|
|
61
|
-
/** Include HttpOnly application-session cookies across origins. */
|
|
62
76
|
withCredentials?: boolean;
|
|
77
|
+
/** Isolate credentials by consumer application/environment. No legacy-key fallback. */
|
|
78
|
+
storageNamespace?: string;
|
|
79
|
+
/** A host using a separate authoritative account protocol can own initialization. */
|
|
80
|
+
syncUserOnInit?: boolean;
|
|
81
|
+
/** Verify consumer identity before committing a refreshed credential. */
|
|
82
|
+
verifyRefresh?: (accessToken: string) => Promise<ClientResult<unknown>>;
|
|
63
83
|
/** Disable when a trusted host manages access-token renewal externally. Defaults to true. */
|
|
64
84
|
autoRefresh?: boolean;
|
|
65
85
|
/**
|
|
@@ -588,7 +608,7 @@ interface Session {
|
|
|
588
608
|
/** Whether this is the current session */
|
|
589
609
|
isCurrent: boolean;
|
|
590
610
|
}
|
|
591
|
-
type AuthEvent = "login" | "logout" | "tokenExpired" | "tokenRefreshed" | "unauthorized";
|
|
611
|
+
type AuthEvent = "credentialsChanged" | "login" | "logout" | "tokenExpired" | "tokenRefreshed" | "unauthorized";
|
|
592
612
|
type EventHandler = (...args: any[]) => void;
|
|
593
613
|
/**
|
|
594
614
|
* Standard success response from backend
|
|
@@ -631,4 +651,4 @@ interface DepartmentPosition {
|
|
|
631
651
|
description?: string;
|
|
632
652
|
}
|
|
633
653
|
|
|
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
|
|
654
|
+
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, createStorageAdapter as G, 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 User as U, type AuthClientOptions as a, type CaptchaResponse as b, type CodeLoginParams as c, type CodeLoginType as d, type LoginParams as e, type LoginType as f, type MiniGetPhoneParams as g, type MiniLoginParams as h, type MiniProgramLoginParams as i, type MiniProgramPlatform as j, type MiniProgramPhoneParams as k, type MiniProgramPhoneResponse as l, type OAuthLoginTicketResponse as m, type OAuthProvider as n, type PermissionDetail as o, type RegisterParams as p, type RegisterResponse as q, type RevokeAllSessionsResponse as r, type Role as s, type RoleDetail as t, type SendCodeParams as u, type SendCodeType as v, type Session as w, type SuccessResponse as x, type UpdateMeParams as y, createMemoryStorage 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 {
|
|
17
|
+
import { U as User, y as UpdateMeParams, C as ChangePasswordParams, x as SuccessResponse } from './types-D5c61dWd.cjs';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* User Management Module
|
|
@@ -37,6 +37,7 @@ interface UserModuleDeps {
|
|
|
37
37
|
onUserUpdate: (user: User) => void;
|
|
38
38
|
getAuthVersion?: () => number | undefined;
|
|
39
39
|
onAuthFailure?: (result: ClientResult<User>) => void;
|
|
40
|
+
isCurrentResult?: (result: ClientResult<unknown>) => boolean;
|
|
40
41
|
}
|
|
41
42
|
declare function createUserModule(deps: UserModuleDeps): {
|
|
42
43
|
/**
|
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 {
|
|
17
|
+
import { U as User, y as UpdateMeParams, C as ChangePasswordParams, x as SuccessResponse } from './types-D5c61dWd.js';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* User Management Module
|
|
@@ -37,6 +37,7 @@ interface UserModuleDeps {
|
|
|
37
37
|
onUserUpdate: (user: User) => void;
|
|
38
38
|
getAuthVersion?: () => number | undefined;
|
|
39
39
|
onAuthFailure?: (result: ClientResult<User>) => void;
|
|
40
|
+
isCurrentResult?: (result: ClientResult<unknown>) => boolean;
|
|
40
41
|
}
|
|
41
42
|
declare function createUserModule(deps: UserModuleDeps): {
|
|
42
43
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amaster.ai/auth-client",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.74",
|
|
4
4
|
"description": "Authentication SDK for Amaster platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -26,6 +26,21 @@
|
|
|
26
26
|
},
|
|
27
27
|
"./sessions": {
|
|
28
28
|
"types": "./dist/sessions.d.ts"
|
|
29
|
+
},
|
|
30
|
+
"./rbac": {
|
|
31
|
+
"types": "./dist/rbac.d.ts",
|
|
32
|
+
"import": "./dist/rbac.js",
|
|
33
|
+
"require": "./dist/rbac.cjs"
|
|
34
|
+
},
|
|
35
|
+
"./tenancy": {
|
|
36
|
+
"types": "./dist/tenancy.d.ts",
|
|
37
|
+
"import": "./dist/tenancy.js",
|
|
38
|
+
"require": "./dist/tenancy.cjs"
|
|
39
|
+
},
|
|
40
|
+
"./tenant-management": {
|
|
41
|
+
"types": "./dist/tenant-management.d.ts",
|
|
42
|
+
"import": "./dist/tenant-management.js",
|
|
43
|
+
"require": "./dist/tenant-management.cjs"
|
|
29
44
|
}
|
|
30
45
|
},
|
|
31
46
|
"files": [
|
|
@@ -47,7 +62,7 @@
|
|
|
47
62
|
"registry": "https://registry.npmjs.org/"
|
|
48
63
|
},
|
|
49
64
|
"dependencies": {
|
|
50
|
-
"@amaster.ai/http-client": "1.1.
|
|
65
|
+
"@amaster.ai/http-client": "1.1.74"
|
|
51
66
|
},
|
|
52
67
|
"peerDependencies": {
|
|
53
68
|
"axios": "^1.11.0"
|