@djangocfg/api 2.1.56 → 2.1.58
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 +125 -9
- package/dist/auth.cjs +1865 -402
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +352 -76
- package/dist/auth.d.ts +352 -76
- package/dist/auth.mjs +1867 -404
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +1637 -137
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +1394 -282
- package/dist/clients.d.ts +1394 -282
- package/dist/clients.mjs +1637 -137
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +24 -11
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +88 -21
- package/dist/hooks.d.ts +88 -21
- package/dist/hooks.mjs +24 -11
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +38 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +94 -21
- package/dist/index.d.ts +94 -21
- package/dist/index.mjs +38 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/auth/context/AccountsContext.tsx +8 -1
- package/src/auth/context/AuthContext.tsx +31 -8
- package/src/auth/context/types.ts +8 -1
- package/src/auth/hooks/index.ts +29 -5
- package/src/auth/hooks/useAuthForm.ts +292 -226
- package/src/auth/hooks/useAuthFormState.ts +60 -0
- package/src/auth/hooks/useAuthValidation.ts +77 -0
- package/src/auth/hooks/useGithubAuth.ts +26 -5
- package/src/auth/hooks/useTwoFactor.ts +239 -0
- package/src/auth/hooks/useTwoFactorSetup.ts +213 -0
- package/src/auth/index.ts +3 -0
- package/src/auth/types/form.ts +194 -0
- package/src/auth/types/index.ts +28 -0
- package/src/clients.ts +10 -0
- package/src/generated/cfg_accounts/_utils/schemas/OAuthTokenResponse.schema.ts +26 -3
- package/src/generated/cfg_accounts/_utils/schemas/OTPVerifyResponse.schema.ts +26 -3
- package/src/generated/cfg_accounts/accounts/client.ts +4 -1
- package/src/generated/cfg_accounts/accounts/models.ts +15 -6
- package/src/generated/cfg_accounts/accounts__oauth/models.ts +16 -7
- package/src/generated/cfg_accounts/client.ts +5 -2
- package/src/generated/cfg_accounts/http.ts +8 -2
- package/src/generated/cfg_accounts/schema.json +47 -19
- package/src/generated/cfg_centrifugo/client.ts +5 -2
- package/src/generated/cfg_centrifugo/http.ts +8 -2
- package/src/generated/cfg_totp/CLAUDE.md +12 -12
- package/src/generated/cfg_totp/_utils/fetchers/index.ts +3 -3
- package/src/generated/cfg_totp/_utils/fetchers/{totp__2fa_management.ts → totp__totp_management.ts} +3 -3
- package/src/generated/cfg_totp/_utils/fetchers/{totp__2fa_setup.ts → totp__totp_setup.ts} +3 -3
- package/src/generated/cfg_totp/_utils/fetchers/{totp__2fa_verification.ts → totp__totp_verification.ts} +3 -3
- package/src/generated/cfg_totp/_utils/hooks/index.ts +3 -3
- package/src/generated/cfg_totp/_utils/hooks/{totp__2fa_management.ts → totp__totp_management.ts} +2 -2
- package/src/generated/cfg_totp/_utils/hooks/{totp__2fa_setup.ts → totp__totp_setup.ts} +2 -2
- package/src/generated/cfg_totp/_utils/hooks/{totp__2fa_verification.ts → totp__totp_verification.ts} +2 -2
- package/src/generated/cfg_totp/_utils/schemas/DeviceList.schema.ts +1 -1
- package/src/generated/cfg_totp/client.ts +14 -11
- package/src/generated/cfg_totp/http.ts +8 -2
- package/src/generated/cfg_totp/index.ts +16 -16
- package/src/generated/cfg_totp/schema.json +8 -7
- package/src/generated/cfg_totp/{totp__2fa_management → totp__totp_management}/client.ts +2 -2
- package/src/generated/cfg_totp/{totp__2fa_management → totp__totp_management}/models.ts +1 -1
- package/src/generated/cfg_totp/{totp__2fa_setup → totp__totp_setup}/client.ts +4 -4
- package/src/generated/cfg_totp/{totp__2fa_verification → totp__totp_verification}/client.ts +2 -2
- package/src/generated/cfg_webpush/client.ts +5 -2
- package/src/generated/cfg_webpush/http.ts +8 -2
- /package/src/generated/cfg_totp/{totp__2fa_management → totp__totp_management}/index.ts +0 -0
- /package/src/generated/cfg_totp/{totp__2fa_setup → totp__totp_setup}/index.ts +0 -0
- /package/src/generated/cfg_totp/{totp__2fa_setup → totp__totp_setup}/models.ts +0 -0
- /package/src/generated/cfg_totp/{totp__2fa_verification → totp__totp_verification}/index.ts +0 -0
- /package/src/generated/cfg_totp/{totp__2fa_verification → totp__totp_verification}/models.ts +0 -0
package/dist/hooks.d.cts
CHANGED
|
@@ -103,21 +103,30 @@ interface OAuthCallbackRequestRequest$1 {
|
|
|
103
103
|
redirect_uri?: string;
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
|
-
* Response with JWT tokens after OAuth authentication.
|
|
106
|
+
* Response with JWT tokens after OAuth authentication. When 2FA is required: -
|
|
107
|
+
* requires_2fa: True - session_id: UUID of 2FA verification session -
|
|
108
|
+
* access/refresh/user: null When 2FA is not required: - requires_2fa: False -
|
|
109
|
+
* session_id: null - access/refresh/user: populated
|
|
107
110
|
*
|
|
108
111
|
* Response model (includes read-only fields).
|
|
109
112
|
*/
|
|
110
113
|
interface OAuthTokenResponse$1 {
|
|
111
|
-
/**
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
|
|
114
|
+
/** True if 2FA verification is required */
|
|
115
|
+
requires_2fa?: boolean;
|
|
116
|
+
/** 2FA session ID (only when requires_2fa=True) */
|
|
117
|
+
session_id?: string | null;
|
|
118
|
+
/** JWT access token (null when requires_2fa=True) */
|
|
119
|
+
access?: string | null;
|
|
120
|
+
/** JWT refresh token (null when requires_2fa=True) */
|
|
121
|
+
refresh?: string | null;
|
|
122
|
+
/** Authenticated user info (null when requires_2fa=True) */
|
|
123
|
+
user?: Record<string, any> | null;
|
|
117
124
|
/** True if a new user was created during this OAuth flow */
|
|
118
125
|
is_new_user: boolean;
|
|
119
126
|
/** True if a new OAuth connection was created */
|
|
120
127
|
is_new_connection: boolean;
|
|
128
|
+
/** True if user should be prompted to enable 2FA */
|
|
129
|
+
should_prompt_2fa?: boolean;
|
|
121
130
|
}
|
|
122
131
|
/**
|
|
123
132
|
* Response with available OAuth providers.
|
|
@@ -329,16 +338,25 @@ interface OTPVerifyRequest$1 {
|
|
|
329
338
|
source_url?: string;
|
|
330
339
|
}
|
|
331
340
|
/**
|
|
332
|
-
* OTP verification response.
|
|
341
|
+
* OTP verification response. When 2FA is required: - requires_2fa: True -
|
|
342
|
+
* session_id: UUID of 2FA verification session - refresh/access/user: null
|
|
343
|
+
* When 2FA is not required: - requires_2fa: False - session_id: null -
|
|
344
|
+
* refresh/access/user: populated
|
|
333
345
|
*
|
|
334
346
|
* Response model (includes read-only fields).
|
|
335
347
|
*/
|
|
336
348
|
interface OTPVerifyResponse$1 {
|
|
337
|
-
/**
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
|
|
341
|
-
|
|
349
|
+
/** Whether 2FA verification is required */
|
|
350
|
+
requires_2fa?: boolean;
|
|
351
|
+
/** 2FA session ID (if requires_2fa is True) */
|
|
352
|
+
session_id?: string | null;
|
|
353
|
+
/** JWT refresh token (if requires_2fa is False) */
|
|
354
|
+
refresh?: string | null;
|
|
355
|
+
/** JWT access token (if requires_2fa is False) */
|
|
356
|
+
access?: string | null;
|
|
357
|
+
user?: User$1 | null;
|
|
358
|
+
/** Whether user should be prompted to enable 2FA */
|
|
359
|
+
should_prompt_2fa?: boolean;
|
|
342
360
|
}
|
|
343
361
|
/**
|
|
344
362
|
* Serializer for user details.
|
|
@@ -397,7 +415,10 @@ declare class Accounts {
|
|
|
397
415
|
*/
|
|
398
416
|
otpRequestCreate(data: OTPRequestRequest$1): Promise<OTPRequestResponse$1>;
|
|
399
417
|
/**
|
|
400
|
-
* Verify OTP code and return JWT tokens.
|
|
418
|
+
* Verify OTP code and return JWT tokens or 2FA session. If user has 2FA
|
|
419
|
+
* enabled: - Returns requires_2fa=True with session_id - Client must
|
|
420
|
+
* complete 2FA verification at /cfg/totp/verify/ If user has no 2FA: -
|
|
421
|
+
* Returns JWT tokens and user data directly
|
|
401
422
|
*/
|
|
402
423
|
otpVerifyCreate(data: OTPVerifyRequest$1): Promise<OTPVerifyResponse$1>;
|
|
403
424
|
}
|
|
@@ -584,17 +605,40 @@ type OAuthDisconnectRequestRequest = z.infer<typeof OAuthDisconnectRequestReques
|
|
|
584
605
|
*
|
|
585
606
|
* This schema provides runtime validation and type inference.
|
|
586
607
|
* * Response with JWT tokens after OAuth authentication.
|
|
608
|
+
|
|
609
|
+
When 2FA is required:
|
|
610
|
+
- requires_2fa: True
|
|
611
|
+
- session_id: UUID of 2FA verification session
|
|
612
|
+
- access/refresh/user: null
|
|
613
|
+
|
|
614
|
+
When 2FA is not required:
|
|
615
|
+
- requires_2fa: False
|
|
616
|
+
- session_id: null
|
|
617
|
+
- access/refresh/user: populated
|
|
587
618
|
* */
|
|
588
619
|
|
|
589
620
|
/**
|
|
590
621
|
* Response with JWT tokens after OAuth authentication.
|
|
622
|
+
|
|
623
|
+
When 2FA is required:
|
|
624
|
+
- requires_2fa: True
|
|
625
|
+
- session_id: UUID of 2FA verification session
|
|
626
|
+
- access/refresh/user: null
|
|
627
|
+
|
|
628
|
+
When 2FA is not required:
|
|
629
|
+
- requires_2fa: False
|
|
630
|
+
- session_id: null
|
|
631
|
+
- access/refresh/user: populated
|
|
591
632
|
*/
|
|
592
633
|
declare const OAuthTokenResponseSchema: z.ZodObject<{
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
634
|
+
requires_2fa: z.ZodOptional<z.ZodBoolean>;
|
|
635
|
+
session_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
636
|
+
access: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
637
|
+
refresh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
638
|
+
user: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
596
639
|
is_new_user: z.ZodBoolean;
|
|
597
640
|
is_new_connection: z.ZodBoolean;
|
|
641
|
+
should_prompt_2fa: z.ZodOptional<z.ZodBoolean>;
|
|
598
642
|
}, z.core.$strip>;
|
|
599
643
|
/**
|
|
600
644
|
* Infer TypeScript type from Zod schema
|
|
@@ -665,15 +709,37 @@ type OTPVerifyRequest = z.infer<typeof OTPVerifyRequestSchema>;
|
|
|
665
709
|
*
|
|
666
710
|
* This schema provides runtime validation and type inference.
|
|
667
711
|
* * OTP verification response.
|
|
712
|
+
|
|
713
|
+
When 2FA is required:
|
|
714
|
+
- requires_2fa: True
|
|
715
|
+
- session_id: UUID of 2FA verification session
|
|
716
|
+
- refresh/access/user: null
|
|
717
|
+
|
|
718
|
+
When 2FA is not required:
|
|
719
|
+
- requires_2fa: False
|
|
720
|
+
- session_id: null
|
|
721
|
+
- refresh/access/user: populated
|
|
668
722
|
* */
|
|
669
723
|
|
|
670
724
|
/**
|
|
671
725
|
* OTP verification response.
|
|
726
|
+
|
|
727
|
+
When 2FA is required:
|
|
728
|
+
- requires_2fa: True
|
|
729
|
+
- session_id: UUID of 2FA verification session
|
|
730
|
+
- refresh/access/user: null
|
|
731
|
+
|
|
732
|
+
When 2FA is not required:
|
|
733
|
+
- requires_2fa: False
|
|
734
|
+
- session_id: null
|
|
735
|
+
- refresh/access/user: populated
|
|
672
736
|
*/
|
|
673
737
|
declare const OTPVerifyResponseSchema: z.ZodObject<{
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
738
|
+
requires_2fa: z.ZodOptional<z.ZodBoolean>;
|
|
739
|
+
session_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
740
|
+
refresh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
741
|
+
access: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
742
|
+
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
677
743
|
id: z.ZodInt;
|
|
678
744
|
email: z.ZodEmail;
|
|
679
745
|
first_name: z.ZodOptional<z.ZodString>;
|
|
@@ -696,7 +762,8 @@ declare const OTPVerifyResponseSchema: z.ZodObject<{
|
|
|
696
762
|
expires_at: z.ZodISODateTime;
|
|
697
763
|
channels: z.ZodArray<z.ZodString>;
|
|
698
764
|
}, z.core.$strip>>;
|
|
699
|
-
}, z.core.$strip
|
|
765
|
+
}, z.core.$strip>>>;
|
|
766
|
+
should_prompt_2fa: z.ZodOptional<z.ZodBoolean>;
|
|
700
767
|
}, z.core.$strip>;
|
|
701
768
|
/**
|
|
702
769
|
* Infer TypeScript type from Zod schema
|
package/dist/hooks.d.ts
CHANGED
|
@@ -103,21 +103,30 @@ interface OAuthCallbackRequestRequest$1 {
|
|
|
103
103
|
redirect_uri?: string;
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
|
-
* Response with JWT tokens after OAuth authentication.
|
|
106
|
+
* Response with JWT tokens after OAuth authentication. When 2FA is required: -
|
|
107
|
+
* requires_2fa: True - session_id: UUID of 2FA verification session -
|
|
108
|
+
* access/refresh/user: null When 2FA is not required: - requires_2fa: False -
|
|
109
|
+
* session_id: null - access/refresh/user: populated
|
|
107
110
|
*
|
|
108
111
|
* Response model (includes read-only fields).
|
|
109
112
|
*/
|
|
110
113
|
interface OAuthTokenResponse$1 {
|
|
111
|
-
/**
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
|
|
114
|
+
/** True if 2FA verification is required */
|
|
115
|
+
requires_2fa?: boolean;
|
|
116
|
+
/** 2FA session ID (only when requires_2fa=True) */
|
|
117
|
+
session_id?: string | null;
|
|
118
|
+
/** JWT access token (null when requires_2fa=True) */
|
|
119
|
+
access?: string | null;
|
|
120
|
+
/** JWT refresh token (null when requires_2fa=True) */
|
|
121
|
+
refresh?: string | null;
|
|
122
|
+
/** Authenticated user info (null when requires_2fa=True) */
|
|
123
|
+
user?: Record<string, any> | null;
|
|
117
124
|
/** True if a new user was created during this OAuth flow */
|
|
118
125
|
is_new_user: boolean;
|
|
119
126
|
/** True if a new OAuth connection was created */
|
|
120
127
|
is_new_connection: boolean;
|
|
128
|
+
/** True if user should be prompted to enable 2FA */
|
|
129
|
+
should_prompt_2fa?: boolean;
|
|
121
130
|
}
|
|
122
131
|
/**
|
|
123
132
|
* Response with available OAuth providers.
|
|
@@ -329,16 +338,25 @@ interface OTPVerifyRequest$1 {
|
|
|
329
338
|
source_url?: string;
|
|
330
339
|
}
|
|
331
340
|
/**
|
|
332
|
-
* OTP verification response.
|
|
341
|
+
* OTP verification response. When 2FA is required: - requires_2fa: True -
|
|
342
|
+
* session_id: UUID of 2FA verification session - refresh/access/user: null
|
|
343
|
+
* When 2FA is not required: - requires_2fa: False - session_id: null -
|
|
344
|
+
* refresh/access/user: populated
|
|
333
345
|
*
|
|
334
346
|
* Response model (includes read-only fields).
|
|
335
347
|
*/
|
|
336
348
|
interface OTPVerifyResponse$1 {
|
|
337
|
-
/**
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
|
|
341
|
-
|
|
349
|
+
/** Whether 2FA verification is required */
|
|
350
|
+
requires_2fa?: boolean;
|
|
351
|
+
/** 2FA session ID (if requires_2fa is True) */
|
|
352
|
+
session_id?: string | null;
|
|
353
|
+
/** JWT refresh token (if requires_2fa is False) */
|
|
354
|
+
refresh?: string | null;
|
|
355
|
+
/** JWT access token (if requires_2fa is False) */
|
|
356
|
+
access?: string | null;
|
|
357
|
+
user?: User$1 | null;
|
|
358
|
+
/** Whether user should be prompted to enable 2FA */
|
|
359
|
+
should_prompt_2fa?: boolean;
|
|
342
360
|
}
|
|
343
361
|
/**
|
|
344
362
|
* Serializer for user details.
|
|
@@ -397,7 +415,10 @@ declare class Accounts {
|
|
|
397
415
|
*/
|
|
398
416
|
otpRequestCreate(data: OTPRequestRequest$1): Promise<OTPRequestResponse$1>;
|
|
399
417
|
/**
|
|
400
|
-
* Verify OTP code and return JWT tokens.
|
|
418
|
+
* Verify OTP code and return JWT tokens or 2FA session. If user has 2FA
|
|
419
|
+
* enabled: - Returns requires_2fa=True with session_id - Client must
|
|
420
|
+
* complete 2FA verification at /cfg/totp/verify/ If user has no 2FA: -
|
|
421
|
+
* Returns JWT tokens and user data directly
|
|
401
422
|
*/
|
|
402
423
|
otpVerifyCreate(data: OTPVerifyRequest$1): Promise<OTPVerifyResponse$1>;
|
|
403
424
|
}
|
|
@@ -584,17 +605,40 @@ type OAuthDisconnectRequestRequest = z.infer<typeof OAuthDisconnectRequestReques
|
|
|
584
605
|
*
|
|
585
606
|
* This schema provides runtime validation and type inference.
|
|
586
607
|
* * Response with JWT tokens after OAuth authentication.
|
|
608
|
+
|
|
609
|
+
When 2FA is required:
|
|
610
|
+
- requires_2fa: True
|
|
611
|
+
- session_id: UUID of 2FA verification session
|
|
612
|
+
- access/refresh/user: null
|
|
613
|
+
|
|
614
|
+
When 2FA is not required:
|
|
615
|
+
- requires_2fa: False
|
|
616
|
+
- session_id: null
|
|
617
|
+
- access/refresh/user: populated
|
|
587
618
|
* */
|
|
588
619
|
|
|
589
620
|
/**
|
|
590
621
|
* Response with JWT tokens after OAuth authentication.
|
|
622
|
+
|
|
623
|
+
When 2FA is required:
|
|
624
|
+
- requires_2fa: True
|
|
625
|
+
- session_id: UUID of 2FA verification session
|
|
626
|
+
- access/refresh/user: null
|
|
627
|
+
|
|
628
|
+
When 2FA is not required:
|
|
629
|
+
- requires_2fa: False
|
|
630
|
+
- session_id: null
|
|
631
|
+
- access/refresh/user: populated
|
|
591
632
|
*/
|
|
592
633
|
declare const OAuthTokenResponseSchema: z.ZodObject<{
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
634
|
+
requires_2fa: z.ZodOptional<z.ZodBoolean>;
|
|
635
|
+
session_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
636
|
+
access: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
637
|
+
refresh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
638
|
+
user: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
596
639
|
is_new_user: z.ZodBoolean;
|
|
597
640
|
is_new_connection: z.ZodBoolean;
|
|
641
|
+
should_prompt_2fa: z.ZodOptional<z.ZodBoolean>;
|
|
598
642
|
}, z.core.$strip>;
|
|
599
643
|
/**
|
|
600
644
|
* Infer TypeScript type from Zod schema
|
|
@@ -665,15 +709,37 @@ type OTPVerifyRequest = z.infer<typeof OTPVerifyRequestSchema>;
|
|
|
665
709
|
*
|
|
666
710
|
* This schema provides runtime validation and type inference.
|
|
667
711
|
* * OTP verification response.
|
|
712
|
+
|
|
713
|
+
When 2FA is required:
|
|
714
|
+
- requires_2fa: True
|
|
715
|
+
- session_id: UUID of 2FA verification session
|
|
716
|
+
- refresh/access/user: null
|
|
717
|
+
|
|
718
|
+
When 2FA is not required:
|
|
719
|
+
- requires_2fa: False
|
|
720
|
+
- session_id: null
|
|
721
|
+
- refresh/access/user: populated
|
|
668
722
|
* */
|
|
669
723
|
|
|
670
724
|
/**
|
|
671
725
|
* OTP verification response.
|
|
726
|
+
|
|
727
|
+
When 2FA is required:
|
|
728
|
+
- requires_2fa: True
|
|
729
|
+
- session_id: UUID of 2FA verification session
|
|
730
|
+
- refresh/access/user: null
|
|
731
|
+
|
|
732
|
+
When 2FA is not required:
|
|
733
|
+
- requires_2fa: False
|
|
734
|
+
- session_id: null
|
|
735
|
+
- refresh/access/user: populated
|
|
672
736
|
*/
|
|
673
737
|
declare const OTPVerifyResponseSchema: z.ZodObject<{
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
738
|
+
requires_2fa: z.ZodOptional<z.ZodBoolean>;
|
|
739
|
+
session_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
740
|
+
refresh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
741
|
+
access: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
742
|
+
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
677
743
|
id: z.ZodInt;
|
|
678
744
|
email: z.ZodEmail;
|
|
679
745
|
first_name: z.ZodOptional<z.ZodString>;
|
|
@@ -696,7 +762,8 @@ declare const OTPVerifyResponseSchema: z.ZodObject<{
|
|
|
696
762
|
expires_at: z.ZodISODateTime;
|
|
697
763
|
channels: z.ZodArray<z.ZodString>;
|
|
698
764
|
}, z.core.$strip>>;
|
|
699
|
-
}, z.core.$strip
|
|
765
|
+
}, z.core.$strip>>>;
|
|
766
|
+
should_prompt_2fa: z.ZodOptional<z.ZodBoolean>;
|
|
700
767
|
}, z.core.$strip>;
|
|
701
768
|
/**
|
|
702
769
|
* Infer TypeScript type from Zod schema
|
package/dist/hooks.mjs
CHANGED
|
@@ -172,7 +172,10 @@ var Accounts = class {
|
|
|
172
172
|
return response;
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
|
-
* Verify OTP code and return JWT tokens.
|
|
175
|
+
* Verify OTP code and return JWT tokens or 2FA session. If user has 2FA
|
|
176
|
+
* enabled: - Returns requires_2fa=True with session_id - Client must
|
|
177
|
+
* complete 2FA verification at /cfg/totp/verify/ If user has no 2FA: -
|
|
178
|
+
* Returns JWT tokens and user data directly
|
|
176
179
|
*/
|
|
177
180
|
async otpVerifyCreate(data) {
|
|
178
181
|
const response = await this.client.request("POST", "/cfg/accounts/otp/verify/", { body: data });
|
|
@@ -186,7 +189,7 @@ var FetchAdapter = class {
|
|
|
186
189
|
__name(this, "FetchAdapter");
|
|
187
190
|
}
|
|
188
191
|
async request(request) {
|
|
189
|
-
const { method, url, headers, body, params, formData } = request;
|
|
192
|
+
const { method, url, headers, body, params, formData, binaryBody } = request;
|
|
190
193
|
let finalUrl = url;
|
|
191
194
|
if (params) {
|
|
192
195
|
const searchParams = new URLSearchParams();
|
|
@@ -204,6 +207,9 @@ var FetchAdapter = class {
|
|
|
204
207
|
let requestBody;
|
|
205
208
|
if (formData) {
|
|
206
209
|
requestBody = formData;
|
|
210
|
+
} else if (binaryBody) {
|
|
211
|
+
finalHeaders["Content-Type"] = "application/octet-stream";
|
|
212
|
+
requestBody = binaryBody;
|
|
207
213
|
} else if (body) {
|
|
208
214
|
finalHeaders["Content-Type"] = "application/json";
|
|
209
215
|
requestBody = JSON.stringify(body);
|
|
@@ -603,7 +609,7 @@ var APIClient = class {
|
|
|
603
609
|
const headers = {
|
|
604
610
|
...options?.headers || {}
|
|
605
611
|
};
|
|
606
|
-
if (!options?.formData && !headers["Content-Type"]) {
|
|
612
|
+
if (!options?.formData && !options?.binaryBody && !headers["Content-Type"]) {
|
|
607
613
|
headers["Content-Type"] = "application/json";
|
|
608
614
|
}
|
|
609
615
|
if (this.logger) {
|
|
@@ -622,7 +628,8 @@ var APIClient = class {
|
|
|
622
628
|
headers,
|
|
623
629
|
params: options?.params,
|
|
624
630
|
body: options?.body,
|
|
625
|
-
formData: options?.formData
|
|
631
|
+
formData: options?.formData,
|
|
632
|
+
binaryBody: options?.binaryBody
|
|
626
633
|
});
|
|
627
634
|
const duration = Date.now() - startTime;
|
|
628
635
|
if (response.status >= 400) {
|
|
@@ -869,11 +876,14 @@ var OAuthProvidersResponseSchema = z9.object({
|
|
|
869
876
|
// src/generated/cfg_accounts/_utils/schemas/OAuthTokenResponse.schema.ts
|
|
870
877
|
import { z as z10 } from "zod";
|
|
871
878
|
var OAuthTokenResponseSchema = z10.object({
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
879
|
+
requires_2fa: z10.boolean().optional(),
|
|
880
|
+
session_id: z10.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i).nullable().optional(),
|
|
881
|
+
access: z10.string().nullable().optional(),
|
|
882
|
+
refresh: z10.string().nullable().optional(),
|
|
883
|
+
user: z10.record(z10.string(), z10.any()).nullable().optional(),
|
|
875
884
|
is_new_user: z10.boolean(),
|
|
876
|
-
is_new_connection: z10.boolean()
|
|
885
|
+
is_new_connection: z10.boolean(),
|
|
886
|
+
should_prompt_2fa: z10.boolean().optional()
|
|
877
887
|
});
|
|
878
888
|
|
|
879
889
|
// src/generated/cfg_accounts/_utils/schemas/OTPErrorResponse.schema.ts
|
|
@@ -932,9 +942,12 @@ var UserSchema = z15.object({
|
|
|
932
942
|
|
|
933
943
|
// src/generated/cfg_accounts/_utils/schemas/OTPVerifyResponse.schema.ts
|
|
934
944
|
var OTPVerifyResponseSchema = z16.object({
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
945
|
+
requires_2fa: z16.boolean().optional(),
|
|
946
|
+
session_id: z16.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i).nullable().optional(),
|
|
947
|
+
refresh: z16.string().nullable().optional(),
|
|
948
|
+
access: z16.string().nullable().optional(),
|
|
949
|
+
user: UserSchema.nullable().optional(),
|
|
950
|
+
should_prompt_2fa: z16.boolean().optional()
|
|
938
951
|
});
|
|
939
952
|
|
|
940
953
|
// src/generated/cfg_accounts/_utils/schemas/PatchedUserProfileUpdateRequest.schema.ts
|