@djangocfg/api 2.1.358 → 2.1.360
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/dist/auth-server.cjs +67 -0
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +67 -0
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +74 -67
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +7 -10
- package/dist/auth.d.ts +7 -10
- package/dist/auth.mjs +74 -67
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +67 -0
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +14 -20
- package/dist/clients.d.ts +14 -20
- package/dist/clients.mjs +67 -0
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +67 -0
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.mjs +67 -0
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +78 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -40
- package/dist/index.d.ts +28 -40
- package/dist/index.mjs +78 -71
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRegenerateCreate.ts +1 -1
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRetrieve.ts +1 -1
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyTestCreate.ts +1 -1
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthConnectionsList.ts +1 -1
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthDisconnectCreate.ts +1 -1
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGithubAuthorizeCreate.ts +1 -1
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGithubCallbackCreate.ts +1 -1
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthProvidersRetrieve.ts +1 -1
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpRequestCreate.ts +1 -1
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpVerifyCreate.ts +1 -1
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileAvatarCreate.ts +1 -1
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileDeleteCreate.ts +1 -1
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialPartialUpdate.ts +1 -1
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialUpdate.ts +1 -1
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileRetrieve.ts +1 -1
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdatePartialUpdate.ts +1 -1
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdateUpdate.ts +1 -1
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsTokenRefreshCreate.ts +1 -1
- package/src/_api/generated/_cfg_accounts/schemas/User.ts +7 -7
- package/src/_api/generated/_cfg_centrifugo/hooks/useCfgCentrifugoAuthTokenRetrieve.ts +1 -1
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpBackupCodesRegenerateCreate.ts +1 -1
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpBackupCodesRetrieve.ts +1 -1
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDevicesRetrieve.ts +1 -1
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDisableCreate.ts +1 -1
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpSetupConfirmCreate.ts +1 -1
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpSetupCreate.ts +1 -1
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpVerifyBackupCreate.ts +1 -1
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpVerifyCreate.ts +1 -1
- package/src/_api/generated/_cfg_totp/schemas/TotpVerifyUser.ts +7 -7
- package/src/_api/generated/helpers/auth.ts +14 -0
- package/src/_api/generated/types.gen.ts +28 -40
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/api",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.360",
|
|
4
4
|
"description": "Auto-generated TypeScript API client with React hooks, SWR integration, and Zod validation for Django REST Framework backends",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"django",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@types/node": "^24.7.2",
|
|
86
86
|
"@types/react": "^19.1.0",
|
|
87
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
87
|
+
"@djangocfg/typescript-config": "^2.1.360",
|
|
88
88
|
"next": "^16.2.2",
|
|
89
89
|
"react": "^19.1.0",
|
|
90
90
|
"tsup": "^8.5.0",
|
|
@@ -8,16 +8,16 @@ import { CentrifugoTokenSchema } from "./CentrifugoToken";
|
|
|
8
8
|
export const UserSchema = z.object({
|
|
9
9
|
id: z.number().int(),
|
|
10
10
|
email: z.email(),
|
|
11
|
-
first_name: z.string().max(50).optional(),
|
|
12
|
-
last_name: z.string().max(50).optional(),
|
|
11
|
+
first_name: z.string().max(50).nullable().optional(),
|
|
12
|
+
last_name: z.string().max(50).nullable().optional(),
|
|
13
13
|
full_name: z.string(),
|
|
14
14
|
initials: z.string(),
|
|
15
15
|
display_username: z.string(),
|
|
16
|
-
company: z.string().max(100).optional(),
|
|
17
|
-
phone: z.string().max(20).optional(),
|
|
18
|
-
position: z.string().max(100).optional(),
|
|
19
|
-
language: z.string().max(10).optional(),
|
|
20
|
-
timezone: z.string().max(64).optional(),
|
|
16
|
+
company: z.string().max(100).nullable().optional(),
|
|
17
|
+
phone: z.string().max(20).nullable().optional(),
|
|
18
|
+
position: z.string().max(100).nullable().optional(),
|
|
19
|
+
language: z.string().max(10).nullable().optional(),
|
|
20
|
+
timezone: z.string().max(64).nullable().optional(),
|
|
21
21
|
avatar: z.string().nullable(),
|
|
22
22
|
is_staff: z.boolean(),
|
|
23
23
|
is_superuser: z.boolean(),
|
|
@@ -7,16 +7,16 @@ import { z } from "zod";
|
|
|
7
7
|
export const TotpVerifyUserSchema = z.object({
|
|
8
8
|
id: z.number().int(),
|
|
9
9
|
email: z.email(),
|
|
10
|
-
first_name: z.string().max(50).optional(),
|
|
11
|
-
last_name: z.string().max(50).optional(),
|
|
10
|
+
first_name: z.string().max(50).nullable().optional(),
|
|
11
|
+
last_name: z.string().max(50).nullable().optional(),
|
|
12
12
|
full_name: z.string(),
|
|
13
13
|
initials: z.string(),
|
|
14
14
|
display_username: z.string(),
|
|
15
|
-
company: z.string().max(100).optional(),
|
|
16
|
-
phone: z.string().max(20).optional(),
|
|
17
|
-
position: z.string().max(100).optional(),
|
|
18
|
-
language: z.string().max(10).optional(),
|
|
19
|
-
timezone: z.string().max(64).optional(),
|
|
15
|
+
company: z.string().max(100).nullable().optional(),
|
|
16
|
+
phone: z.string().max(20).nullable().optional(),
|
|
17
|
+
position: z.string().max(100).nullable().optional(),
|
|
18
|
+
language: z.string().max(10).nullable().optional(),
|
|
19
|
+
timezone: z.string().max(64).nullable().optional(),
|
|
20
20
|
avatar: z.string().nullable(),
|
|
21
21
|
is_staff: z.boolean(),
|
|
22
22
|
is_superuser: z.boolean(),
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
// post-processed bottom of client.gen.ts. No circular import here.
|
|
5
5
|
// DO NOT EDIT — re-run `make gen`.
|
|
6
6
|
|
|
7
|
+
import { APIError } from './errors';
|
|
8
|
+
|
|
7
9
|
const ACCESS_KEY = 'cfg.access_token';
|
|
8
10
|
const REFRESH_KEY = 'cfg.refresh_token';
|
|
9
11
|
const API_KEY_KEY = 'cfg.api_key';
|
|
@@ -132,6 +134,7 @@ type HeyClient = {
|
|
|
132
134
|
interceptors: {
|
|
133
135
|
request: { use(fn: (req: Request) => Request | Promise<Request>): void };
|
|
134
136
|
response: { use(fn: (res: Response, req: Request) => Response | Promise<Response>): void };
|
|
137
|
+
error: { use(fn: (err: unknown, res: Response | undefined, req: Request | undefined, opts: unknown) => unknown): void };
|
|
135
138
|
};
|
|
136
139
|
};
|
|
137
140
|
let _client: HeyClient | null = null;
|
|
@@ -301,6 +304,17 @@ export function installAuthOnClient(client: HeyClient): void {
|
|
|
301
304
|
return request;
|
|
302
305
|
});
|
|
303
306
|
|
|
307
|
+
// Wrap raw JSON error objects (thrown by hey-api on non-2xx responses) into
|
|
308
|
+
// APIError so callers can do `error instanceof APIError` and read
|
|
309
|
+
// `error.statusCode` / `error.response` consistently.
|
|
310
|
+
client.interceptors.error.use((err, res, req) => {
|
|
311
|
+
if (err instanceof APIError) return err;
|
|
312
|
+
const url = (req as Request | undefined)?.url ?? '';
|
|
313
|
+
const status = (res as Response | undefined)?.status ?? 0;
|
|
314
|
+
const statusText = (res as Response | undefined)?.statusText ?? '';
|
|
315
|
+
return new APIError(status, statusText, err, url);
|
|
316
|
+
});
|
|
317
|
+
|
|
304
318
|
client.interceptors.response.use(async (response, request) => {
|
|
305
319
|
if (response.status !== 401) return response;
|
|
306
320
|
|
|
@@ -636,8 +636,8 @@ export type TokenRefreshRequest = {
|
|
|
636
636
|
export type TotpVerifyUser = {
|
|
637
637
|
readonly id: number;
|
|
638
638
|
readonly email: string;
|
|
639
|
-
first_name?: string;
|
|
640
|
-
last_name?: string;
|
|
639
|
+
first_name?: string | null;
|
|
640
|
+
last_name?: string | null;
|
|
641
641
|
/**
|
|
642
642
|
* Get user's full name.
|
|
643
643
|
*/
|
|
@@ -650,14 +650,11 @@ export type TotpVerifyUser = {
|
|
|
650
650
|
* Get formatted username for display.
|
|
651
651
|
*/
|
|
652
652
|
readonly display_username: string;
|
|
653
|
-
company?: string;
|
|
654
|
-
phone?: string;
|
|
655
|
-
position?: string;
|
|
656
|
-
language?: string;
|
|
657
|
-
|
|
658
|
-
* IANA timezone name (e.g. 'Asia/Seoul'). Auto-detected from browser via X-Timezone header.
|
|
659
|
-
*/
|
|
660
|
-
timezone?: string;
|
|
653
|
+
company?: string | null;
|
|
654
|
+
phone?: string | null;
|
|
655
|
+
position?: string | null;
|
|
656
|
+
language?: string | null;
|
|
657
|
+
timezone?: string | null;
|
|
661
658
|
readonly avatar: string | null;
|
|
662
659
|
/**
|
|
663
660
|
* Staff status
|
|
@@ -683,8 +680,8 @@ export type TotpVerifyUser = {
|
|
|
683
680
|
export type User = {
|
|
684
681
|
readonly id: number;
|
|
685
682
|
readonly email: string;
|
|
686
|
-
first_name?: string;
|
|
687
|
-
last_name?: string;
|
|
683
|
+
first_name?: string | null;
|
|
684
|
+
last_name?: string | null;
|
|
688
685
|
/**
|
|
689
686
|
* Get user's full name.
|
|
690
687
|
*/
|
|
@@ -697,14 +694,11 @@ export type User = {
|
|
|
697
694
|
* Get formatted username for display.
|
|
698
695
|
*/
|
|
699
696
|
readonly display_username: string;
|
|
700
|
-
company?: string;
|
|
701
|
-
phone?: string;
|
|
702
|
-
position?: string;
|
|
703
|
-
language?: string;
|
|
704
|
-
|
|
705
|
-
* IANA timezone name (e.g. 'Asia/Seoul'). Auto-detected from browser via X-Timezone header.
|
|
706
|
-
*/
|
|
707
|
-
timezone?: string;
|
|
697
|
+
company?: string | null;
|
|
698
|
+
phone?: string | null;
|
|
699
|
+
position?: string | null;
|
|
700
|
+
language?: string | null;
|
|
701
|
+
timezone?: string | null;
|
|
708
702
|
readonly avatar: string | null;
|
|
709
703
|
/**
|
|
710
704
|
* Staff status
|
|
@@ -847,32 +841,26 @@ export type TokenRefreshWritable = {
|
|
|
847
841
|
* User data returned after 2FA verification.
|
|
848
842
|
*/
|
|
849
843
|
export type TotpVerifyUserWritable = {
|
|
850
|
-
first_name?: string;
|
|
851
|
-
last_name?: string;
|
|
852
|
-
company?: string;
|
|
853
|
-
phone?: string;
|
|
854
|
-
position?: string;
|
|
855
|
-
language?: string;
|
|
856
|
-
|
|
857
|
-
* IANA timezone name (e.g. 'Asia/Seoul'). Auto-detected from browser via X-Timezone header.
|
|
858
|
-
*/
|
|
859
|
-
timezone?: string;
|
|
844
|
+
first_name?: string | null;
|
|
845
|
+
last_name?: string | null;
|
|
846
|
+
company?: string | null;
|
|
847
|
+
phone?: string | null;
|
|
848
|
+
position?: string | null;
|
|
849
|
+
language?: string | null;
|
|
850
|
+
timezone?: string | null;
|
|
860
851
|
};
|
|
861
852
|
|
|
862
853
|
/**
|
|
863
854
|
* Serializer for user details.
|
|
864
855
|
*/
|
|
865
856
|
export type UserWritable = {
|
|
866
|
-
first_name?: string;
|
|
867
|
-
last_name?: string;
|
|
868
|
-
company?: string;
|
|
869
|
-
phone?: string;
|
|
870
|
-
position?: string;
|
|
871
|
-
language?: string;
|
|
872
|
-
|
|
873
|
-
* IANA timezone name (e.g. 'Asia/Seoul'). Auto-detected from browser via X-Timezone header.
|
|
874
|
-
*/
|
|
875
|
-
timezone?: string;
|
|
857
|
+
first_name?: string | null;
|
|
858
|
+
last_name?: string | null;
|
|
859
|
+
company?: string | null;
|
|
860
|
+
phone?: string | null;
|
|
861
|
+
position?: string | null;
|
|
862
|
+
language?: string | null;
|
|
863
|
+
timezone?: string | null;
|
|
876
864
|
};
|
|
877
865
|
|
|
878
866
|
/**
|