@amaster.ai/auth-client 1.1.2 → 1.1.4
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 +105 -86
- package/dist/auth.d.cts +43 -30
- package/dist/auth.d.ts +43 -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-YfiSfMTJ.d.cts → types-CsCZTBIx.d.cts} +60 -24
- package/dist/{types-YfiSfMTJ.d.ts → types-CsCZTBIx.d.ts} +60 -24
- 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
|
/**
|
|
@@ -406,7 +399,7 @@ interface ChangePasswordParams {
|
|
|
406
399
|
* - google: Google OAuth
|
|
407
400
|
* - github: GitHub OAuth
|
|
408
401
|
* - wechat: WeChat Open Platform OAuth (for web/mobile apps)
|
|
409
|
-
* - wechat_mini:
|
|
402
|
+
* - wechat_mini: legacy mini-program provider marker kept for compatibility
|
|
410
403
|
* - platform: AMaster Platform OAuth
|
|
411
404
|
*/
|
|
412
405
|
type OAuthProvider = "google" | "github" | "wechat" | "wechat_mini" | "platform";
|
|
@@ -419,45 +412,88 @@ interface OAuthBinding {
|
|
|
419
412
|
createdAt: string;
|
|
420
413
|
}
|
|
421
414
|
/**
|
|
422
|
-
*
|
|
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
|
|
423
432
|
* @example
|
|
424
433
|
* ```typescript
|
|
425
|
-
* //
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
*
|
|
431
|
-
* }
|
|
434
|
+
* // WeChat
|
|
435
|
+
* await authClient.miniLogin();
|
|
436
|
+
*
|
|
437
|
+
* // Douyin
|
|
438
|
+
* await authClient.miniLogin({
|
|
439
|
+
* platform: "douyin",
|
|
432
440
|
* });
|
|
433
441
|
* ```
|
|
434
442
|
*/
|
|
435
443
|
interface MiniProgramLoginParams {
|
|
436
|
-
/** Code from
|
|
444
|
+
/** Code from mini-program login API, valid for a short time */
|
|
437
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;
|
|
438
451
|
}
|
|
439
452
|
/**
|
|
440
|
-
*
|
|
453
|
+
* Mini Program phone number parameters
|
|
441
454
|
* @example
|
|
442
455
|
* ```typescript
|
|
443
|
-
* // WXML
|
|
456
|
+
* // WeChat WXML
|
|
444
457
|
* <button open-type="getPhoneNumber" bindgetphonenumber="onGetPhoneNumber">
|
|
445
458
|
* Get Phone Number
|
|
446
459
|
* </button>
|
|
447
460
|
*
|
|
448
461
|
* // JS
|
|
449
462
|
* async onGetPhoneNumber(e) {
|
|
450
|
-
*
|
|
451
|
-
* if (code) {
|
|
452
|
-
* await authClient.getMiniProgramPhoneNumber(code);
|
|
453
|
-
* }
|
|
463
|
+
* await authClient.miniGetPhone(e);
|
|
454
464
|
* }
|
|
465
|
+
*
|
|
466
|
+
* // Douyin
|
|
467
|
+
* await authClient.miniGetPhone({
|
|
468
|
+
* code,
|
|
469
|
+
* platform: "douyin",
|
|
470
|
+
* });
|
|
455
471
|
* ```
|
|
456
472
|
*/
|
|
457
473
|
interface MiniProgramPhoneParams {
|
|
458
474
|
/** Code from getPhoneNumber button event */
|
|
459
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;
|
|
460
492
|
}
|
|
493
|
+
/**
|
|
494
|
+
* Unified Mini Program phone input
|
|
495
|
+
*/
|
|
496
|
+
type MiniGetPhoneParams = string | MiniProgramPhoneParams | MiniGetPhoneEvent;
|
|
461
497
|
/**
|
|
462
498
|
* WeChat Mini Program phone number response
|
|
463
499
|
*/
|
|
@@ -539,4 +575,4 @@ interface RevokeAllSessionsResponse {
|
|
|
539
575
|
revokedCount: number;
|
|
540
576
|
}
|
|
541
577
|
|
|
542
|
-
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.1.
|
|
3
|
+
"version": "1.1.4",
|
|
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.1.
|
|
50
|
+
"@amaster.ai/http-client": "1.1.4"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"axios": "^1.11.0"
|