@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/index.d.cts
CHANGED
|
@@ -136,21 +136,30 @@ interface OAuthCallbackRequestRequest$1 {
|
|
|
136
136
|
redirect_uri?: string;
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
|
-
* Response with JWT tokens after OAuth authentication.
|
|
139
|
+
* Response with JWT tokens after OAuth authentication. When 2FA is required: -
|
|
140
|
+
* requires_2fa: True - session_id: UUID of 2FA verification session -
|
|
141
|
+
* access/refresh/user: null When 2FA is not required: - requires_2fa: False -
|
|
142
|
+
* session_id: null - access/refresh/user: populated
|
|
140
143
|
*
|
|
141
144
|
* Response model (includes read-only fields).
|
|
142
145
|
*/
|
|
143
146
|
interface OAuthTokenResponse$1 {
|
|
144
|
-
/**
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
|
|
147
|
+
/** True if 2FA verification is required */
|
|
148
|
+
requires_2fa?: boolean;
|
|
149
|
+
/** 2FA session ID (only when requires_2fa=True) */
|
|
150
|
+
session_id?: string | null;
|
|
151
|
+
/** JWT access token (null when requires_2fa=True) */
|
|
152
|
+
access?: string | null;
|
|
153
|
+
/** JWT refresh token (null when requires_2fa=True) */
|
|
154
|
+
refresh?: string | null;
|
|
155
|
+
/** Authenticated user info (null when requires_2fa=True) */
|
|
156
|
+
user?: Record<string, any> | null;
|
|
150
157
|
/** True if a new user was created during this OAuth flow */
|
|
151
158
|
is_new_user: boolean;
|
|
152
159
|
/** True if a new OAuth connection was created */
|
|
153
160
|
is_new_connection: boolean;
|
|
161
|
+
/** True if user should be prompted to enable 2FA */
|
|
162
|
+
should_prompt_2fa?: boolean;
|
|
154
163
|
}
|
|
155
164
|
/**
|
|
156
165
|
* Response with available OAuth providers.
|
|
@@ -379,16 +388,25 @@ interface OTPVerifyRequest$1 {
|
|
|
379
388
|
source_url?: string;
|
|
380
389
|
}
|
|
381
390
|
/**
|
|
382
|
-
* OTP verification response.
|
|
391
|
+
* OTP verification response. When 2FA is required: - requires_2fa: True -
|
|
392
|
+
* session_id: UUID of 2FA verification session - refresh/access/user: null
|
|
393
|
+
* When 2FA is not required: - requires_2fa: False - session_id: null -
|
|
394
|
+
* refresh/access/user: populated
|
|
383
395
|
*
|
|
384
396
|
* Response model (includes read-only fields).
|
|
385
397
|
*/
|
|
386
398
|
interface OTPVerifyResponse$1 {
|
|
387
|
-
/**
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
|
|
391
|
-
|
|
399
|
+
/** Whether 2FA verification is required */
|
|
400
|
+
requires_2fa?: boolean;
|
|
401
|
+
/** 2FA session ID (if requires_2fa is True) */
|
|
402
|
+
session_id?: string | null;
|
|
403
|
+
/** JWT refresh token (if requires_2fa is False) */
|
|
404
|
+
refresh?: string | null;
|
|
405
|
+
/** JWT access token (if requires_2fa is False) */
|
|
406
|
+
access?: string | null;
|
|
407
|
+
user?: User$1 | null;
|
|
408
|
+
/** Whether user should be prompted to enable 2FA */
|
|
409
|
+
should_prompt_2fa?: boolean;
|
|
392
410
|
}
|
|
393
411
|
/**
|
|
394
412
|
* Serializer for user details.
|
|
@@ -451,7 +469,10 @@ declare class Accounts {
|
|
|
451
469
|
*/
|
|
452
470
|
otpRequestCreate(data: OTPRequestRequest$1): Promise<OTPRequestResponse$1>;
|
|
453
471
|
/**
|
|
454
|
-
* Verify OTP code and return JWT tokens.
|
|
472
|
+
* Verify OTP code and return JWT tokens or 2FA session. If user has 2FA
|
|
473
|
+
* enabled: - Returns requires_2fa=True with session_id - Client must
|
|
474
|
+
* complete 2FA verification at /cfg/totp/verify/ If user has no 2FA: -
|
|
475
|
+
* Returns JWT tokens and user data directly
|
|
455
476
|
*/
|
|
456
477
|
otpVerifyCreate(data: OTPVerifyRequest$1): Promise<OTPVerifyResponse$1>;
|
|
457
478
|
}
|
|
@@ -470,6 +491,8 @@ interface HttpRequest$1 {
|
|
|
470
491
|
params?: Record<string, any>;
|
|
471
492
|
/** FormData for file uploads (multipart/form-data) */
|
|
472
493
|
formData?: FormData;
|
|
494
|
+
/** Binary data for octet-stream uploads */
|
|
495
|
+
binaryBody?: Blob | ArrayBuffer;
|
|
473
496
|
}
|
|
474
497
|
interface HttpResponse$1<T = any> {
|
|
475
498
|
data: T;
|
|
@@ -745,6 +768,7 @@ declare class APIClient$1 {
|
|
|
745
768
|
params?: Record<string, any>;
|
|
746
769
|
body?: any;
|
|
747
770
|
formData?: FormData;
|
|
771
|
+
binaryBody?: Blob | ArrayBuffer;
|
|
748
772
|
headers?: Record<string, string>;
|
|
749
773
|
}): Promise<T>;
|
|
750
774
|
/**
|
|
@@ -973,17 +997,40 @@ type OAuthProvidersResponse = z.infer<typeof OAuthProvidersResponseSchema>;
|
|
|
973
997
|
*
|
|
974
998
|
* This schema provides runtime validation and type inference.
|
|
975
999
|
* * Response with JWT tokens after OAuth authentication.
|
|
1000
|
+
|
|
1001
|
+
When 2FA is required:
|
|
1002
|
+
- requires_2fa: True
|
|
1003
|
+
- session_id: UUID of 2FA verification session
|
|
1004
|
+
- access/refresh/user: null
|
|
1005
|
+
|
|
1006
|
+
When 2FA is not required:
|
|
1007
|
+
- requires_2fa: False
|
|
1008
|
+
- session_id: null
|
|
1009
|
+
- access/refresh/user: populated
|
|
976
1010
|
* */
|
|
977
1011
|
|
|
978
1012
|
/**
|
|
979
1013
|
* Response with JWT tokens after OAuth authentication.
|
|
1014
|
+
|
|
1015
|
+
When 2FA is required:
|
|
1016
|
+
- requires_2fa: True
|
|
1017
|
+
- session_id: UUID of 2FA verification session
|
|
1018
|
+
- access/refresh/user: null
|
|
1019
|
+
|
|
1020
|
+
When 2FA is not required:
|
|
1021
|
+
- requires_2fa: False
|
|
1022
|
+
- session_id: null
|
|
1023
|
+
- access/refresh/user: populated
|
|
980
1024
|
*/
|
|
981
1025
|
declare const OAuthTokenResponseSchema: z.ZodObject<{
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
1026
|
+
requires_2fa: z.ZodOptional<z.ZodBoolean>;
|
|
1027
|
+
session_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1028
|
+
access: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1029
|
+
refresh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1030
|
+
user: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
985
1031
|
is_new_user: z.ZodBoolean;
|
|
986
1032
|
is_new_connection: z.ZodBoolean;
|
|
1033
|
+
should_prompt_2fa: z.ZodOptional<z.ZodBoolean>;
|
|
987
1034
|
}, z.core.$strip>;
|
|
988
1035
|
/**
|
|
989
1036
|
* Infer TypeScript type from Zod schema
|
|
@@ -1072,15 +1119,37 @@ type OTPVerifyRequest = z.infer<typeof OTPVerifyRequestSchema>;
|
|
|
1072
1119
|
*
|
|
1073
1120
|
* This schema provides runtime validation and type inference.
|
|
1074
1121
|
* * OTP verification response.
|
|
1122
|
+
|
|
1123
|
+
When 2FA is required:
|
|
1124
|
+
- requires_2fa: True
|
|
1125
|
+
- session_id: UUID of 2FA verification session
|
|
1126
|
+
- refresh/access/user: null
|
|
1127
|
+
|
|
1128
|
+
When 2FA is not required:
|
|
1129
|
+
- requires_2fa: False
|
|
1130
|
+
- session_id: null
|
|
1131
|
+
- refresh/access/user: populated
|
|
1075
1132
|
* */
|
|
1076
1133
|
|
|
1077
1134
|
/**
|
|
1078
1135
|
* OTP verification response.
|
|
1136
|
+
|
|
1137
|
+
When 2FA is required:
|
|
1138
|
+
- requires_2fa: True
|
|
1139
|
+
- session_id: UUID of 2FA verification session
|
|
1140
|
+
- refresh/access/user: null
|
|
1141
|
+
|
|
1142
|
+
When 2FA is not required:
|
|
1143
|
+
- requires_2fa: False
|
|
1144
|
+
- session_id: null
|
|
1145
|
+
- refresh/access/user: populated
|
|
1079
1146
|
*/
|
|
1080
1147
|
declare const OTPVerifyResponseSchema: z.ZodObject<{
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1148
|
+
requires_2fa: z.ZodOptional<z.ZodBoolean>;
|
|
1149
|
+
session_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1150
|
+
refresh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1151
|
+
access: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1152
|
+
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1084
1153
|
id: z.ZodInt;
|
|
1085
1154
|
email: z.ZodEmail;
|
|
1086
1155
|
first_name: z.ZodOptional<z.ZodString>;
|
|
@@ -1103,7 +1172,8 @@ declare const OTPVerifyResponseSchema: z.ZodObject<{
|
|
|
1103
1172
|
expires_at: z.ZodISODateTime;
|
|
1104
1173
|
channels: z.ZodArray<z.ZodString>;
|
|
1105
1174
|
}, z.core.$strip>>;
|
|
1106
|
-
}, z.core.$strip
|
|
1175
|
+
}, z.core.$strip>>>;
|
|
1176
|
+
should_prompt_2fa: z.ZodOptional<z.ZodBoolean>;
|
|
1107
1177
|
}, z.core.$strip>;
|
|
1108
1178
|
/**
|
|
1109
1179
|
* Infer TypeScript type from Zod schema
|
|
@@ -1947,6 +2017,8 @@ interface HttpRequest {
|
|
|
1947
2017
|
params?: Record<string, any>;
|
|
1948
2018
|
/** FormData for file uploads (multipart/form-data) */
|
|
1949
2019
|
formData?: FormData;
|
|
2020
|
+
/** Binary data for octet-stream uploads */
|
|
2021
|
+
binaryBody?: Blob | ArrayBuffer;
|
|
1950
2022
|
}
|
|
1951
2023
|
interface HttpResponse<T = any> {
|
|
1952
2024
|
data: T;
|
|
@@ -2219,6 +2291,7 @@ declare class APIClient {
|
|
|
2219
2291
|
params?: Record<string, any>;
|
|
2220
2292
|
body?: any;
|
|
2221
2293
|
formData?: FormData;
|
|
2294
|
+
binaryBody?: Blob | ArrayBuffer;
|
|
2222
2295
|
headers?: Record<string, string>;
|
|
2223
2296
|
}): Promise<T>;
|
|
2224
2297
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -136,21 +136,30 @@ interface OAuthCallbackRequestRequest$1 {
|
|
|
136
136
|
redirect_uri?: string;
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
|
-
* Response with JWT tokens after OAuth authentication.
|
|
139
|
+
* Response with JWT tokens after OAuth authentication. When 2FA is required: -
|
|
140
|
+
* requires_2fa: True - session_id: UUID of 2FA verification session -
|
|
141
|
+
* access/refresh/user: null When 2FA is not required: - requires_2fa: False -
|
|
142
|
+
* session_id: null - access/refresh/user: populated
|
|
140
143
|
*
|
|
141
144
|
* Response model (includes read-only fields).
|
|
142
145
|
*/
|
|
143
146
|
interface OAuthTokenResponse$1 {
|
|
144
|
-
/**
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
|
|
147
|
+
/** True if 2FA verification is required */
|
|
148
|
+
requires_2fa?: boolean;
|
|
149
|
+
/** 2FA session ID (only when requires_2fa=True) */
|
|
150
|
+
session_id?: string | null;
|
|
151
|
+
/** JWT access token (null when requires_2fa=True) */
|
|
152
|
+
access?: string | null;
|
|
153
|
+
/** JWT refresh token (null when requires_2fa=True) */
|
|
154
|
+
refresh?: string | null;
|
|
155
|
+
/** Authenticated user info (null when requires_2fa=True) */
|
|
156
|
+
user?: Record<string, any> | null;
|
|
150
157
|
/** True if a new user was created during this OAuth flow */
|
|
151
158
|
is_new_user: boolean;
|
|
152
159
|
/** True if a new OAuth connection was created */
|
|
153
160
|
is_new_connection: boolean;
|
|
161
|
+
/** True if user should be prompted to enable 2FA */
|
|
162
|
+
should_prompt_2fa?: boolean;
|
|
154
163
|
}
|
|
155
164
|
/**
|
|
156
165
|
* Response with available OAuth providers.
|
|
@@ -379,16 +388,25 @@ interface OTPVerifyRequest$1 {
|
|
|
379
388
|
source_url?: string;
|
|
380
389
|
}
|
|
381
390
|
/**
|
|
382
|
-
* OTP verification response.
|
|
391
|
+
* OTP verification response. When 2FA is required: - requires_2fa: True -
|
|
392
|
+
* session_id: UUID of 2FA verification session - refresh/access/user: null
|
|
393
|
+
* When 2FA is not required: - requires_2fa: False - session_id: null -
|
|
394
|
+
* refresh/access/user: populated
|
|
383
395
|
*
|
|
384
396
|
* Response model (includes read-only fields).
|
|
385
397
|
*/
|
|
386
398
|
interface OTPVerifyResponse$1 {
|
|
387
|
-
/**
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
|
|
391
|
-
|
|
399
|
+
/** Whether 2FA verification is required */
|
|
400
|
+
requires_2fa?: boolean;
|
|
401
|
+
/** 2FA session ID (if requires_2fa is True) */
|
|
402
|
+
session_id?: string | null;
|
|
403
|
+
/** JWT refresh token (if requires_2fa is False) */
|
|
404
|
+
refresh?: string | null;
|
|
405
|
+
/** JWT access token (if requires_2fa is False) */
|
|
406
|
+
access?: string | null;
|
|
407
|
+
user?: User$1 | null;
|
|
408
|
+
/** Whether user should be prompted to enable 2FA */
|
|
409
|
+
should_prompt_2fa?: boolean;
|
|
392
410
|
}
|
|
393
411
|
/**
|
|
394
412
|
* Serializer for user details.
|
|
@@ -451,7 +469,10 @@ declare class Accounts {
|
|
|
451
469
|
*/
|
|
452
470
|
otpRequestCreate(data: OTPRequestRequest$1): Promise<OTPRequestResponse$1>;
|
|
453
471
|
/**
|
|
454
|
-
* Verify OTP code and return JWT tokens.
|
|
472
|
+
* Verify OTP code and return JWT tokens or 2FA session. If user has 2FA
|
|
473
|
+
* enabled: - Returns requires_2fa=True with session_id - Client must
|
|
474
|
+
* complete 2FA verification at /cfg/totp/verify/ If user has no 2FA: -
|
|
475
|
+
* Returns JWT tokens and user data directly
|
|
455
476
|
*/
|
|
456
477
|
otpVerifyCreate(data: OTPVerifyRequest$1): Promise<OTPVerifyResponse$1>;
|
|
457
478
|
}
|
|
@@ -470,6 +491,8 @@ interface HttpRequest$1 {
|
|
|
470
491
|
params?: Record<string, any>;
|
|
471
492
|
/** FormData for file uploads (multipart/form-data) */
|
|
472
493
|
formData?: FormData;
|
|
494
|
+
/** Binary data for octet-stream uploads */
|
|
495
|
+
binaryBody?: Blob | ArrayBuffer;
|
|
473
496
|
}
|
|
474
497
|
interface HttpResponse$1<T = any> {
|
|
475
498
|
data: T;
|
|
@@ -745,6 +768,7 @@ declare class APIClient$1 {
|
|
|
745
768
|
params?: Record<string, any>;
|
|
746
769
|
body?: any;
|
|
747
770
|
formData?: FormData;
|
|
771
|
+
binaryBody?: Blob | ArrayBuffer;
|
|
748
772
|
headers?: Record<string, string>;
|
|
749
773
|
}): Promise<T>;
|
|
750
774
|
/**
|
|
@@ -973,17 +997,40 @@ type OAuthProvidersResponse = z.infer<typeof OAuthProvidersResponseSchema>;
|
|
|
973
997
|
*
|
|
974
998
|
* This schema provides runtime validation and type inference.
|
|
975
999
|
* * Response with JWT tokens after OAuth authentication.
|
|
1000
|
+
|
|
1001
|
+
When 2FA is required:
|
|
1002
|
+
- requires_2fa: True
|
|
1003
|
+
- session_id: UUID of 2FA verification session
|
|
1004
|
+
- access/refresh/user: null
|
|
1005
|
+
|
|
1006
|
+
When 2FA is not required:
|
|
1007
|
+
- requires_2fa: False
|
|
1008
|
+
- session_id: null
|
|
1009
|
+
- access/refresh/user: populated
|
|
976
1010
|
* */
|
|
977
1011
|
|
|
978
1012
|
/**
|
|
979
1013
|
* Response with JWT tokens after OAuth authentication.
|
|
1014
|
+
|
|
1015
|
+
When 2FA is required:
|
|
1016
|
+
- requires_2fa: True
|
|
1017
|
+
- session_id: UUID of 2FA verification session
|
|
1018
|
+
- access/refresh/user: null
|
|
1019
|
+
|
|
1020
|
+
When 2FA is not required:
|
|
1021
|
+
- requires_2fa: False
|
|
1022
|
+
- session_id: null
|
|
1023
|
+
- access/refresh/user: populated
|
|
980
1024
|
*/
|
|
981
1025
|
declare const OAuthTokenResponseSchema: z.ZodObject<{
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
1026
|
+
requires_2fa: z.ZodOptional<z.ZodBoolean>;
|
|
1027
|
+
session_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1028
|
+
access: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1029
|
+
refresh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1030
|
+
user: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
985
1031
|
is_new_user: z.ZodBoolean;
|
|
986
1032
|
is_new_connection: z.ZodBoolean;
|
|
1033
|
+
should_prompt_2fa: z.ZodOptional<z.ZodBoolean>;
|
|
987
1034
|
}, z.core.$strip>;
|
|
988
1035
|
/**
|
|
989
1036
|
* Infer TypeScript type from Zod schema
|
|
@@ -1072,15 +1119,37 @@ type OTPVerifyRequest = z.infer<typeof OTPVerifyRequestSchema>;
|
|
|
1072
1119
|
*
|
|
1073
1120
|
* This schema provides runtime validation and type inference.
|
|
1074
1121
|
* * OTP verification response.
|
|
1122
|
+
|
|
1123
|
+
When 2FA is required:
|
|
1124
|
+
- requires_2fa: True
|
|
1125
|
+
- session_id: UUID of 2FA verification session
|
|
1126
|
+
- refresh/access/user: null
|
|
1127
|
+
|
|
1128
|
+
When 2FA is not required:
|
|
1129
|
+
- requires_2fa: False
|
|
1130
|
+
- session_id: null
|
|
1131
|
+
- refresh/access/user: populated
|
|
1075
1132
|
* */
|
|
1076
1133
|
|
|
1077
1134
|
/**
|
|
1078
1135
|
* OTP verification response.
|
|
1136
|
+
|
|
1137
|
+
When 2FA is required:
|
|
1138
|
+
- requires_2fa: True
|
|
1139
|
+
- session_id: UUID of 2FA verification session
|
|
1140
|
+
- refresh/access/user: null
|
|
1141
|
+
|
|
1142
|
+
When 2FA is not required:
|
|
1143
|
+
- requires_2fa: False
|
|
1144
|
+
- session_id: null
|
|
1145
|
+
- refresh/access/user: populated
|
|
1079
1146
|
*/
|
|
1080
1147
|
declare const OTPVerifyResponseSchema: z.ZodObject<{
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1148
|
+
requires_2fa: z.ZodOptional<z.ZodBoolean>;
|
|
1149
|
+
session_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1150
|
+
refresh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1151
|
+
access: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
1152
|
+
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
1084
1153
|
id: z.ZodInt;
|
|
1085
1154
|
email: z.ZodEmail;
|
|
1086
1155
|
first_name: z.ZodOptional<z.ZodString>;
|
|
@@ -1103,7 +1172,8 @@ declare const OTPVerifyResponseSchema: z.ZodObject<{
|
|
|
1103
1172
|
expires_at: z.ZodISODateTime;
|
|
1104
1173
|
channels: z.ZodArray<z.ZodString>;
|
|
1105
1174
|
}, z.core.$strip>>;
|
|
1106
|
-
}, z.core.$strip
|
|
1175
|
+
}, z.core.$strip>>>;
|
|
1176
|
+
should_prompt_2fa: z.ZodOptional<z.ZodBoolean>;
|
|
1107
1177
|
}, z.core.$strip>;
|
|
1108
1178
|
/**
|
|
1109
1179
|
* Infer TypeScript type from Zod schema
|
|
@@ -1947,6 +2017,8 @@ interface HttpRequest {
|
|
|
1947
2017
|
params?: Record<string, any>;
|
|
1948
2018
|
/** FormData for file uploads (multipart/form-data) */
|
|
1949
2019
|
formData?: FormData;
|
|
2020
|
+
/** Binary data for octet-stream uploads */
|
|
2021
|
+
binaryBody?: Blob | ArrayBuffer;
|
|
1950
2022
|
}
|
|
1951
2023
|
interface HttpResponse<T = any> {
|
|
1952
2024
|
data: T;
|
|
@@ -2219,6 +2291,7 @@ declare class APIClient {
|
|
|
2219
2291
|
params?: Record<string, any>;
|
|
2220
2292
|
body?: any;
|
|
2221
2293
|
formData?: FormData;
|
|
2294
|
+
binaryBody?: Blob | ArrayBuffer;
|
|
2222
2295
|
headers?: Record<string, string>;
|
|
2223
2296
|
}): Promise<T>;
|
|
2224
2297
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -240,7 +240,10 @@ var Accounts = class {
|
|
|
240
240
|
return response;
|
|
241
241
|
}
|
|
242
242
|
/**
|
|
243
|
-
* Verify OTP code and return JWT tokens.
|
|
243
|
+
* Verify OTP code and return JWT tokens or 2FA session. If user has 2FA
|
|
244
|
+
* enabled: - Returns requires_2fa=True with session_id - Client must
|
|
245
|
+
* complete 2FA verification at /cfg/totp/verify/ If user has no 2FA: -
|
|
246
|
+
* Returns JWT tokens and user data directly
|
|
244
247
|
*/
|
|
245
248
|
async otpVerifyCreate(data) {
|
|
246
249
|
const response = await this.client.request("POST", "/cfg/accounts/otp/verify/", { body: data });
|
|
@@ -257,7 +260,7 @@ var FetchAdapter = class {
|
|
|
257
260
|
__name(this, "FetchAdapter");
|
|
258
261
|
}
|
|
259
262
|
async request(request) {
|
|
260
|
-
const { method, url, headers, body, params, formData } = request;
|
|
263
|
+
const { method, url, headers, body, params, formData, binaryBody } = request;
|
|
261
264
|
let finalUrl = url;
|
|
262
265
|
if (params) {
|
|
263
266
|
const searchParams = new URLSearchParams();
|
|
@@ -275,6 +278,9 @@ var FetchAdapter = class {
|
|
|
275
278
|
let requestBody;
|
|
276
279
|
if (formData) {
|
|
277
280
|
requestBody = formData;
|
|
281
|
+
} else if (binaryBody) {
|
|
282
|
+
finalHeaders["Content-Type"] = "application/octet-stream";
|
|
283
|
+
requestBody = binaryBody;
|
|
278
284
|
} else if (body) {
|
|
279
285
|
finalHeaders["Content-Type"] = "application/json";
|
|
280
286
|
requestBody = JSON.stringify(body);
|
|
@@ -674,7 +680,7 @@ var APIClient = class {
|
|
|
674
680
|
const headers = {
|
|
675
681
|
...options?.headers || {}
|
|
676
682
|
};
|
|
677
|
-
if (!options?.formData && !headers["Content-Type"]) {
|
|
683
|
+
if (!options?.formData && !options?.binaryBody && !headers["Content-Type"]) {
|
|
678
684
|
headers["Content-Type"] = "application/json";
|
|
679
685
|
}
|
|
680
686
|
if (this.logger) {
|
|
@@ -693,7 +699,8 @@ var APIClient = class {
|
|
|
693
699
|
headers,
|
|
694
700
|
params: options?.params,
|
|
695
701
|
body: options?.body,
|
|
696
|
-
formData: options?.formData
|
|
702
|
+
formData: options?.formData,
|
|
703
|
+
binaryBody: options?.binaryBody
|
|
697
704
|
});
|
|
698
705
|
const duration = Date.now() - startTime;
|
|
699
706
|
if (response.status >= 400) {
|
|
@@ -1044,11 +1051,14 @@ var OAuthProvidersResponseSchema = z8.object({
|
|
|
1044
1051
|
// src/generated/cfg_accounts/_utils/schemas/OAuthTokenResponse.schema.ts
|
|
1045
1052
|
import { z as z9 } from "zod";
|
|
1046
1053
|
var OAuthTokenResponseSchema = z9.object({
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1054
|
+
requires_2fa: z9.boolean().optional(),
|
|
1055
|
+
session_id: z9.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(),
|
|
1056
|
+
access: z9.string().nullable().optional(),
|
|
1057
|
+
refresh: z9.string().nullable().optional(),
|
|
1058
|
+
user: z9.record(z9.string(), z9.any()).nullable().optional(),
|
|
1050
1059
|
is_new_user: z9.boolean(),
|
|
1051
|
-
is_new_connection: z9.boolean()
|
|
1060
|
+
is_new_connection: z9.boolean(),
|
|
1061
|
+
should_prompt_2fa: z9.boolean().optional()
|
|
1052
1062
|
});
|
|
1053
1063
|
|
|
1054
1064
|
// src/generated/cfg_accounts/_utils/schemas/OTPErrorResponse.schema.ts
|
|
@@ -1107,9 +1117,12 @@ var UserSchema = z14.object({
|
|
|
1107
1117
|
|
|
1108
1118
|
// src/generated/cfg_accounts/_utils/schemas/OTPVerifyResponse.schema.ts
|
|
1109
1119
|
var OTPVerifyResponseSchema = z15.object({
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1120
|
+
requires_2fa: z15.boolean().optional(),
|
|
1121
|
+
session_id: z15.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(),
|
|
1122
|
+
refresh: z15.string().nullable().optional(),
|
|
1123
|
+
access: z15.string().nullable().optional(),
|
|
1124
|
+
user: UserSchema.nullable().optional(),
|
|
1125
|
+
should_prompt_2fa: z15.boolean().optional()
|
|
1113
1126
|
});
|
|
1114
1127
|
|
|
1115
1128
|
// src/generated/cfg_accounts/_utils/schemas/PatchedUserProfileUpdateRequest.schema.ts
|
|
@@ -2160,7 +2173,7 @@ var FetchAdapter2 = class {
|
|
|
2160
2173
|
__name(this, "FetchAdapter");
|
|
2161
2174
|
}
|
|
2162
2175
|
async request(request) {
|
|
2163
|
-
const { method, url, headers, body, params, formData } = request;
|
|
2176
|
+
const { method, url, headers, body, params, formData, binaryBody } = request;
|
|
2164
2177
|
let finalUrl = url;
|
|
2165
2178
|
if (params) {
|
|
2166
2179
|
const searchParams = new URLSearchParams();
|
|
@@ -2178,6 +2191,9 @@ var FetchAdapter2 = class {
|
|
|
2178
2191
|
let requestBody;
|
|
2179
2192
|
if (formData) {
|
|
2180
2193
|
requestBody = formData;
|
|
2194
|
+
} else if (binaryBody) {
|
|
2195
|
+
finalHeaders["Content-Type"] = "application/octet-stream";
|
|
2196
|
+
requestBody = binaryBody;
|
|
2181
2197
|
} else if (body) {
|
|
2182
2198
|
finalHeaders["Content-Type"] = "application/json";
|
|
2183
2199
|
requestBody = JSON.stringify(body);
|
|
@@ -2577,7 +2593,7 @@ var APIClient2 = class {
|
|
|
2577
2593
|
const headers = {
|
|
2578
2594
|
...options?.headers || {}
|
|
2579
2595
|
};
|
|
2580
|
-
if (!options?.formData && !headers["Content-Type"]) {
|
|
2596
|
+
if (!options?.formData && !options?.binaryBody && !headers["Content-Type"]) {
|
|
2581
2597
|
headers["Content-Type"] = "application/json";
|
|
2582
2598
|
}
|
|
2583
2599
|
if (this.logger) {
|
|
@@ -2596,7 +2612,8 @@ var APIClient2 = class {
|
|
|
2596
2612
|
headers,
|
|
2597
2613
|
params: options?.params,
|
|
2598
2614
|
body: options?.body,
|
|
2599
|
-
formData: options?.formData
|
|
2615
|
+
formData: options?.formData,
|
|
2616
|
+
binaryBody: options?.binaryBody
|
|
2600
2617
|
});
|
|
2601
2618
|
const duration = Date.now() - startTime;
|
|
2602
2619
|
if (response.status >= 400) {
|
|
@@ -3368,7 +3385,7 @@ var FetchAdapter3 = class {
|
|
|
3368
3385
|
__name(this, "FetchAdapter");
|
|
3369
3386
|
}
|
|
3370
3387
|
async request(request) {
|
|
3371
|
-
const { method, url, headers, body, params, formData } = request;
|
|
3388
|
+
const { method, url, headers, body, params, formData, binaryBody } = request;
|
|
3372
3389
|
let finalUrl = url;
|
|
3373
3390
|
if (params) {
|
|
3374
3391
|
const searchParams = new URLSearchParams();
|
|
@@ -3386,6 +3403,9 @@ var FetchAdapter3 = class {
|
|
|
3386
3403
|
let requestBody;
|
|
3387
3404
|
if (formData) {
|
|
3388
3405
|
requestBody = formData;
|
|
3406
|
+
} else if (binaryBody) {
|
|
3407
|
+
finalHeaders["Content-Type"] = "application/octet-stream";
|
|
3408
|
+
requestBody = binaryBody;
|
|
3389
3409
|
} else if (body) {
|
|
3390
3410
|
finalHeaders["Content-Type"] = "application/json";
|
|
3391
3411
|
requestBody = JSON.stringify(body);
|
|
@@ -3782,7 +3802,7 @@ var APIClient3 = class {
|
|
|
3782
3802
|
const headers = {
|
|
3783
3803
|
...options?.headers || {}
|
|
3784
3804
|
};
|
|
3785
|
-
if (!options?.formData && !headers["Content-Type"]) {
|
|
3805
|
+
if (!options?.formData && !options?.binaryBody && !headers["Content-Type"]) {
|
|
3786
3806
|
headers["Content-Type"] = "application/json";
|
|
3787
3807
|
}
|
|
3788
3808
|
if (this.logger) {
|
|
@@ -3801,7 +3821,8 @@ var APIClient3 = class {
|
|
|
3801
3821
|
headers,
|
|
3802
3822
|
params: options?.params,
|
|
3803
3823
|
body: options?.body,
|
|
3804
|
-
formData: options?.formData
|
|
3824
|
+
formData: options?.formData,
|
|
3825
|
+
binaryBody: options?.binaryBody
|
|
3805
3826
|
});
|
|
3806
3827
|
const duration = Date.now() - startTime;
|
|
3807
3828
|
if (response.status >= 400) {
|