@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/dist/clients.d.cts
CHANGED
|
@@ -958,8 +958,8 @@ type TokenRefreshRequest = {
|
|
|
958
958
|
type TotpVerifyUser = {
|
|
959
959
|
readonly id: number;
|
|
960
960
|
readonly email: string;
|
|
961
|
-
first_name?: string;
|
|
962
|
-
last_name?: string;
|
|
961
|
+
first_name?: string | null;
|
|
962
|
+
last_name?: string | null;
|
|
963
963
|
/**
|
|
964
964
|
* Get user's full name.
|
|
965
965
|
*/
|
|
@@ -972,14 +972,11 @@ type TotpVerifyUser = {
|
|
|
972
972
|
* Get formatted username for display.
|
|
973
973
|
*/
|
|
974
974
|
readonly display_username: string;
|
|
975
|
-
company?: string;
|
|
976
|
-
phone?: string;
|
|
977
|
-
position?: string;
|
|
978
|
-
language?: string;
|
|
979
|
-
|
|
980
|
-
* IANA timezone name (e.g. 'Asia/Seoul'). Auto-detected from browser via X-Timezone header.
|
|
981
|
-
*/
|
|
982
|
-
timezone?: string;
|
|
975
|
+
company?: string | null;
|
|
976
|
+
phone?: string | null;
|
|
977
|
+
position?: string | null;
|
|
978
|
+
language?: string | null;
|
|
979
|
+
timezone?: string | null;
|
|
983
980
|
readonly avatar: string | null;
|
|
984
981
|
/**
|
|
985
982
|
* Staff status
|
|
@@ -1004,8 +1001,8 @@ type TotpVerifyUser = {
|
|
|
1004
1001
|
type User = {
|
|
1005
1002
|
readonly id: number;
|
|
1006
1003
|
readonly email: string;
|
|
1007
|
-
first_name?: string;
|
|
1008
|
-
last_name?: string;
|
|
1004
|
+
first_name?: string | null;
|
|
1005
|
+
last_name?: string | null;
|
|
1009
1006
|
/**
|
|
1010
1007
|
* Get user's full name.
|
|
1011
1008
|
*/
|
|
@@ -1018,14 +1015,11 @@ type User = {
|
|
|
1018
1015
|
* Get formatted username for display.
|
|
1019
1016
|
*/
|
|
1020
1017
|
readonly display_username: string;
|
|
1021
|
-
company?: string;
|
|
1022
|
-
phone?: string;
|
|
1023
|
-
position?: string;
|
|
1024
|
-
language?: string;
|
|
1025
|
-
|
|
1026
|
-
* IANA timezone name (e.g. 'Asia/Seoul'). Auto-detected from browser via X-Timezone header.
|
|
1027
|
-
*/
|
|
1028
|
-
timezone?: string;
|
|
1018
|
+
company?: string | null;
|
|
1019
|
+
phone?: string | null;
|
|
1020
|
+
position?: string | null;
|
|
1021
|
+
language?: string | null;
|
|
1022
|
+
timezone?: string | null;
|
|
1029
1023
|
readonly avatar: string | null;
|
|
1030
1024
|
/**
|
|
1031
1025
|
* Staff status
|
package/dist/clients.d.ts
CHANGED
|
@@ -958,8 +958,8 @@ type TokenRefreshRequest = {
|
|
|
958
958
|
type TotpVerifyUser = {
|
|
959
959
|
readonly id: number;
|
|
960
960
|
readonly email: string;
|
|
961
|
-
first_name?: string;
|
|
962
|
-
last_name?: string;
|
|
961
|
+
first_name?: string | null;
|
|
962
|
+
last_name?: string | null;
|
|
963
963
|
/**
|
|
964
964
|
* Get user's full name.
|
|
965
965
|
*/
|
|
@@ -972,14 +972,11 @@ type TotpVerifyUser = {
|
|
|
972
972
|
* Get formatted username for display.
|
|
973
973
|
*/
|
|
974
974
|
readonly display_username: string;
|
|
975
|
-
company?: string;
|
|
976
|
-
phone?: string;
|
|
977
|
-
position?: string;
|
|
978
|
-
language?: string;
|
|
979
|
-
|
|
980
|
-
* IANA timezone name (e.g. 'Asia/Seoul'). Auto-detected from browser via X-Timezone header.
|
|
981
|
-
*/
|
|
982
|
-
timezone?: string;
|
|
975
|
+
company?: string | null;
|
|
976
|
+
phone?: string | null;
|
|
977
|
+
position?: string | null;
|
|
978
|
+
language?: string | null;
|
|
979
|
+
timezone?: string | null;
|
|
983
980
|
readonly avatar: string | null;
|
|
984
981
|
/**
|
|
985
982
|
* Staff status
|
|
@@ -1004,8 +1001,8 @@ type TotpVerifyUser = {
|
|
|
1004
1001
|
type User = {
|
|
1005
1002
|
readonly id: number;
|
|
1006
1003
|
readonly email: string;
|
|
1007
|
-
first_name?: string;
|
|
1008
|
-
last_name?: string;
|
|
1004
|
+
first_name?: string | null;
|
|
1005
|
+
last_name?: string | null;
|
|
1009
1006
|
/**
|
|
1010
1007
|
* Get user's full name.
|
|
1011
1008
|
*/
|
|
@@ -1018,14 +1015,11 @@ type User = {
|
|
|
1018
1015
|
* Get formatted username for display.
|
|
1019
1016
|
*/
|
|
1020
1017
|
readonly display_username: string;
|
|
1021
|
-
company?: string;
|
|
1022
|
-
phone?: string;
|
|
1023
|
-
position?: string;
|
|
1024
|
-
language?: string;
|
|
1025
|
-
|
|
1026
|
-
* IANA timezone name (e.g. 'Asia/Seoul'). Auto-detected from browser via X-Timezone header.
|
|
1027
|
-
*/
|
|
1028
|
-
timezone?: string;
|
|
1018
|
+
company?: string | null;
|
|
1019
|
+
phone?: string | null;
|
|
1020
|
+
position?: string | null;
|
|
1021
|
+
language?: string | null;
|
|
1022
|
+
timezone?: string | null;
|
|
1029
1023
|
readonly avatar: string | null;
|
|
1030
1024
|
/**
|
|
1031
1025
|
* Staff status
|
package/dist/clients.mjs
CHANGED
|
@@ -2,6 +2,66 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
4
|
|
|
5
|
+
// src/_api/generated/helpers/errors.ts
|
|
6
|
+
var APIError = class extends Error {
|
|
7
|
+
constructor(statusCode, statusText, response, url, message) {
|
|
8
|
+
super(message || `HTTP ${statusCode}: ${statusText}`);
|
|
9
|
+
this.statusCode = statusCode;
|
|
10
|
+
this.statusText = statusText;
|
|
11
|
+
this.response = response;
|
|
12
|
+
this.url = url;
|
|
13
|
+
this.name = "APIError";
|
|
14
|
+
}
|
|
15
|
+
static {
|
|
16
|
+
__name(this, "APIError");
|
|
17
|
+
}
|
|
18
|
+
get details() {
|
|
19
|
+
if (typeof this.response === "object" && this.response !== null) {
|
|
20
|
+
return this.response;
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
get fieldErrors() {
|
|
25
|
+
const details = this.details;
|
|
26
|
+
if (!details) return null;
|
|
27
|
+
const fieldErrors = {};
|
|
28
|
+
for (const [key, value] of Object.entries(details)) {
|
|
29
|
+
if (Array.isArray(value)) fieldErrors[key] = value;
|
|
30
|
+
}
|
|
31
|
+
return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
|
|
32
|
+
}
|
|
33
|
+
get errorMessage() {
|
|
34
|
+
const details = this.details;
|
|
35
|
+
if (!details) return this.message;
|
|
36
|
+
if (details.detail) {
|
|
37
|
+
return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
|
|
38
|
+
}
|
|
39
|
+
if (details.error) return String(details.error);
|
|
40
|
+
if (details.message) return String(details.message);
|
|
41
|
+
const fieldErrors = this.fieldErrors;
|
|
42
|
+
if (fieldErrors) {
|
|
43
|
+
const firstField = Object.keys(fieldErrors)[0];
|
|
44
|
+
if (firstField) return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
|
|
45
|
+
}
|
|
46
|
+
return this.message;
|
|
47
|
+
}
|
|
48
|
+
get isValidationError() {
|
|
49
|
+
return this.statusCode === 400;
|
|
50
|
+
}
|
|
51
|
+
get isAuthError() {
|
|
52
|
+
return this.statusCode === 401;
|
|
53
|
+
}
|
|
54
|
+
get isPermissionError() {
|
|
55
|
+
return this.statusCode === 403;
|
|
56
|
+
}
|
|
57
|
+
get isNotFoundError() {
|
|
58
|
+
return this.statusCode === 404;
|
|
59
|
+
}
|
|
60
|
+
get isServerError() {
|
|
61
|
+
return this.statusCode >= 500 && this.statusCode < 600;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
5
65
|
// src/_api/generated/helpers/auth.ts
|
|
6
66
|
var ACCESS_KEY = "cfg.access_token";
|
|
7
67
|
var REFRESH_KEY = "cfg.refresh_token";
|
|
@@ -244,6 +304,13 @@ function installAuthOnClient(client2) {
|
|
|
244
304
|
request.headers.set("X-Client-Time", (/* @__PURE__ */ new Date()).toISOString());
|
|
245
305
|
return request;
|
|
246
306
|
});
|
|
307
|
+
client2.interceptors.error.use((err, res, req) => {
|
|
308
|
+
if (err instanceof APIError) return err;
|
|
309
|
+
const url = req?.url ?? "";
|
|
310
|
+
const status = res?.status ?? 0;
|
|
311
|
+
const statusText = res?.statusText ?? "";
|
|
312
|
+
return new APIError(status, statusText, err, url);
|
|
313
|
+
});
|
|
247
314
|
client2.interceptors.response.use(async (response, request) => {
|
|
248
315
|
if (response.status !== 401) return response;
|
|
249
316
|
if (request.headers.get(RETRY_MARKER)) {
|