@amaster.ai/auth-client 1.0.0-beta.74 → 1.0.0-beta.76
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 +110 -86
- package/dist/auth.d.cts +44 -30
- package/dist/auth.d.ts +44 -30
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- 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 +1 -1
- package/dist/permissions.d.ts +1 -1
- package/dist/sessions.d.cts +1 -1
- package/dist/sessions.d.ts +1 -1
- package/dist/{types-DGF9cpAg.d.cts → types-CsCZTBIx.d.cts} +96 -9
- package/dist/{types-DGF9cpAg.d.ts → types-CsCZTBIx.d.ts} +96 -9
- package/dist/user.d.cts +1 -1
- package/dist/user.d.ts +1 -1
- package/package.json +4 -4
|
@@ -34,13 +34,6 @@
|
|
|
34
34
|
* });
|
|
35
35
|
* ```
|
|
36
36
|
*
|
|
37
|
-
* @example
|
|
38
|
-
* With custom base URL:
|
|
39
|
-
* ```typescript
|
|
40
|
-
* const authClient = createAuthClient({
|
|
41
|
-
* baseURL: "https://api.example.com",
|
|
42
|
-
* });
|
|
43
|
-
* ```
|
|
44
37
|
*/
|
|
45
38
|
interface AuthClientOptions {
|
|
46
39
|
/**
|
|
@@ -332,6 +325,17 @@ interface LoginResponse {
|
|
|
332
325
|
accessToken: string;
|
|
333
326
|
/** Token expiration time in seconds */
|
|
334
327
|
expiresIn?: number;
|
|
328
|
+
/**
|
|
329
|
+
* Whether the SDK has already consumed the current page's `?redirect=...`
|
|
330
|
+
* and started browser navigation.
|
|
331
|
+
*
|
|
332
|
+
* Use this to avoid running application-level success redirects twice.
|
|
333
|
+
*/
|
|
334
|
+
redirectHandled?: boolean;
|
|
335
|
+
/**
|
|
336
|
+
* The redirect target consumed by the SDK when `redirectHandled` is `true`.
|
|
337
|
+
*/
|
|
338
|
+
redirectTarget?: string;
|
|
335
339
|
}
|
|
336
340
|
/**
|
|
337
341
|
* Register response - user and accessToken are optional
|
|
@@ -395,7 +399,7 @@ interface ChangePasswordParams {
|
|
|
395
399
|
* - google: Google OAuth
|
|
396
400
|
* - github: GitHub OAuth
|
|
397
401
|
* - wechat: WeChat Open Platform OAuth (for web/mobile apps)
|
|
398
|
-
* - wechat_mini:
|
|
402
|
+
* - wechat_mini: legacy mini-program provider marker kept for compatibility
|
|
399
403
|
* - platform: AMaster Platform OAuth
|
|
400
404
|
*/
|
|
401
405
|
type OAuthProvider = "google" | "github" | "wechat" | "wechat_mini" | "platform";
|
|
@@ -407,6 +411,89 @@ interface OAuthBinding {
|
|
|
407
411
|
avatarUrl: string | null;
|
|
408
412
|
createdAt: string;
|
|
409
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* Mini Program platform type
|
|
416
|
+
* - wechat: WeChat Mini Program
|
|
417
|
+
* - douyin: Douyin Mini Program
|
|
418
|
+
*/
|
|
419
|
+
type MiniProgramPlatform = "wechat" | "douyin";
|
|
420
|
+
/**
|
|
421
|
+
* Unified Mini Program login options
|
|
422
|
+
*/
|
|
423
|
+
interface MiniLoginParams {
|
|
424
|
+
/**
|
|
425
|
+
* Optional explicit platform override.
|
|
426
|
+
* When omitted, the SDK auto-detects the current mini-program runtime.
|
|
427
|
+
*/
|
|
428
|
+
platform?: MiniProgramPlatform;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Mini Program login parameters
|
|
432
|
+
* @example
|
|
433
|
+
* ```typescript
|
|
434
|
+
* // WeChat
|
|
435
|
+
* await authClient.miniLogin();
|
|
436
|
+
*
|
|
437
|
+
* // Douyin
|
|
438
|
+
* await authClient.miniLogin({
|
|
439
|
+
* platform: "douyin",
|
|
440
|
+
* });
|
|
441
|
+
* ```
|
|
442
|
+
*/
|
|
443
|
+
interface MiniProgramLoginParams {
|
|
444
|
+
/** Code from mini-program login API, valid for a short time */
|
|
445
|
+
code: string;
|
|
446
|
+
/**
|
|
447
|
+
* Optional explicit platform override
|
|
448
|
+
* When omitted, the SDK will auto-detect the current mini-program runtime.
|
|
449
|
+
*/
|
|
450
|
+
platform?: MiniProgramPlatform;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Mini Program phone number parameters
|
|
454
|
+
* @example
|
|
455
|
+
* ```typescript
|
|
456
|
+
* // WeChat WXML
|
|
457
|
+
* <button open-type="getPhoneNumber" bindgetphonenumber="onGetPhoneNumber">
|
|
458
|
+
* Get Phone Number
|
|
459
|
+
* </button>
|
|
460
|
+
*
|
|
461
|
+
* // JS
|
|
462
|
+
* async onGetPhoneNumber(e) {
|
|
463
|
+
* await authClient.miniGetPhone(e);
|
|
464
|
+
* }
|
|
465
|
+
*
|
|
466
|
+
* // Douyin
|
|
467
|
+
* await authClient.miniGetPhone({
|
|
468
|
+
* code,
|
|
469
|
+
* platform: "douyin",
|
|
470
|
+
* });
|
|
471
|
+
* ```
|
|
472
|
+
*/
|
|
473
|
+
interface MiniProgramPhoneParams {
|
|
474
|
+
/** Code from getPhoneNumber button event */
|
|
475
|
+
code: string;
|
|
476
|
+
/**
|
|
477
|
+
* Optional explicit platform override
|
|
478
|
+
* When omitted, the SDK will auto-detect the current mini-program runtime.
|
|
479
|
+
*/
|
|
480
|
+
platform?: MiniProgramPlatform;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Mini Program phone event-like payload
|
|
484
|
+
* Compatible with WeChat `wx`, Douyin `tt`, and Taro event objects.
|
|
485
|
+
*/
|
|
486
|
+
interface MiniGetPhoneEvent {
|
|
487
|
+
code?: string;
|
|
488
|
+
platform?: MiniProgramPlatform;
|
|
489
|
+
detail?: {
|
|
490
|
+
code?: string;
|
|
491
|
+
} | null;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Unified Mini Program phone input
|
|
495
|
+
*/
|
|
496
|
+
type MiniGetPhoneParams = string | MiniProgramPhoneParams | MiniGetPhoneEvent;
|
|
410
497
|
/**
|
|
411
498
|
* WeChat Mini Program phone number response
|
|
412
499
|
*/
|
|
@@ -488,4 +575,4 @@ interface RevokeAllSessionsResponse {
|
|
|
488
575
|
revokedCount: number;
|
|
489
576
|
}
|
|
490
577
|
|
|
491
|
-
export type { AuthClientOptions as A, ChangePasswordParams as C, EventHandler as E, LoginParams as L,
|
|
578
|
+
export type { AuthClientOptions as A, ChangePasswordParams as C, EventHandler as E, 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, OAuthProvider as m, PermissionDetail as n, RegisterParams as o, RegisterResponse as p, RevokeAllSessionsResponse as q, Role as r, RoleDetail as s, SendCodeType as t, Session as u, SuccessResponse as v, User as w };
|
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 { w as User, U as UpdateMeParams, C as ChangePasswordParams, v as SuccessResponse } from './types-CsCZTBIx.cjs';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* User Management Module
|
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 { w as User, U as UpdateMeParams, C as ChangePasswordParams, v as SuccessResponse } from './types-CsCZTBIx.js';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* User Management Module
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amaster.ai/auth-client",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.76",
|
|
4
4
|
"description": "Authentication SDK for Amaster platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
11
12
|
"import": "./dist/index.js",
|
|
12
|
-
"require": "./dist/index.cjs"
|
|
13
|
-
"types": "./dist/index.d.ts"
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
14
|
},
|
|
15
15
|
"./auth": {
|
|
16
16
|
"types": "./dist/auth.d.ts"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"registry": "https://registry.npmjs.org/"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@amaster.ai/http-client": "1.0.0-beta.
|
|
50
|
+
"@amaster.ai/http-client": "1.0.0-beta.76"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"axios": "^1.11.0"
|