@djangocfg/api 2.1.359 → 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.
Files changed (58) hide show
  1. package/dist/auth-server.cjs +67 -0
  2. package/dist/auth-server.cjs.map +1 -1
  3. package/dist/auth-server.mjs +67 -0
  4. package/dist/auth-server.mjs.map +1 -1
  5. package/dist/auth.cjs +74 -67
  6. package/dist/auth.cjs.map +1 -1
  7. package/dist/auth.d.cts +7 -10
  8. package/dist/auth.d.ts +7 -10
  9. package/dist/auth.mjs +74 -67
  10. package/dist/auth.mjs.map +1 -1
  11. package/dist/clients.cjs +67 -0
  12. package/dist/clients.cjs.map +1 -1
  13. package/dist/clients.d.cts +14 -20
  14. package/dist/clients.d.ts +14 -20
  15. package/dist/clients.mjs +67 -0
  16. package/dist/clients.mjs.map +1 -1
  17. package/dist/hooks.cjs +67 -0
  18. package/dist/hooks.cjs.map +1 -1
  19. package/dist/hooks.mjs +67 -0
  20. package/dist/hooks.mjs.map +1 -1
  21. package/dist/index.cjs +78 -71
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +28 -40
  24. package/dist/index.d.ts +28 -40
  25. package/dist/index.mjs +78 -71
  26. package/dist/index.mjs.map +1 -1
  27. package/package.json +2 -2
  28. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRegenerateCreate.ts +1 -1
  29. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRetrieve.ts +1 -1
  30. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyTestCreate.ts +1 -1
  31. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthConnectionsList.ts +1 -1
  32. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthDisconnectCreate.ts +1 -1
  33. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGithubAuthorizeCreate.ts +1 -1
  34. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGithubCallbackCreate.ts +1 -1
  35. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthProvidersRetrieve.ts +1 -1
  36. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpRequestCreate.ts +1 -1
  37. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpVerifyCreate.ts +1 -1
  38. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileAvatarCreate.ts +1 -1
  39. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileDeleteCreate.ts +1 -1
  40. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialPartialUpdate.ts +1 -1
  41. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialUpdate.ts +1 -1
  42. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileRetrieve.ts +1 -1
  43. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdatePartialUpdate.ts +1 -1
  44. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdateUpdate.ts +1 -1
  45. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsTokenRefreshCreate.ts +1 -1
  46. package/src/_api/generated/_cfg_accounts/schemas/User.ts +7 -7
  47. package/src/_api/generated/_cfg_centrifugo/hooks/useCfgCentrifugoAuthTokenRetrieve.ts +1 -1
  48. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpBackupCodesRegenerateCreate.ts +1 -1
  49. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpBackupCodesRetrieve.ts +1 -1
  50. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDevicesRetrieve.ts +1 -1
  51. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDisableCreate.ts +1 -1
  52. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpSetupConfirmCreate.ts +1 -1
  53. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpSetupCreate.ts +1 -1
  54. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpVerifyBackupCreate.ts +1 -1
  55. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpVerifyCreate.ts +1 -1
  56. package/src/_api/generated/_cfg_totp/schemas/TotpVerifyUser.ts +7 -7
  57. package/src/_api/generated/helpers/auth.ts +14 -0
  58. package/src/_api/generated/types.gen.ts +28 -40
package/dist/index.d.cts CHANGED
@@ -1031,8 +1031,8 @@ type TokenRefreshRequest = {
1031
1031
  type TotpVerifyUser = {
1032
1032
  readonly id: number;
1033
1033
  readonly email: string;
1034
- first_name?: string;
1035
- last_name?: string;
1034
+ first_name?: string | null;
1035
+ last_name?: string | null;
1036
1036
  /**
1037
1037
  * Get user's full name.
1038
1038
  */
@@ -1045,14 +1045,11 @@ type TotpVerifyUser = {
1045
1045
  * Get formatted username for display.
1046
1046
  */
1047
1047
  readonly display_username: string;
1048
- company?: string;
1049
- phone?: string;
1050
- position?: string;
1051
- language?: string;
1052
- /**
1053
- * IANA timezone name (e.g. 'Asia/Seoul'). Auto-detected from browser via X-Timezone header.
1054
- */
1055
- timezone?: string;
1048
+ company?: string | null;
1049
+ phone?: string | null;
1050
+ position?: string | null;
1051
+ language?: string | null;
1052
+ timezone?: string | null;
1056
1053
  readonly avatar: string | null;
1057
1054
  /**
1058
1055
  * Staff status
@@ -1077,8 +1074,8 @@ type TotpVerifyUser = {
1077
1074
  type User = {
1078
1075
  readonly id: number;
1079
1076
  readonly email: string;
1080
- first_name?: string;
1081
- last_name?: string;
1077
+ first_name?: string | null;
1078
+ last_name?: string | null;
1082
1079
  /**
1083
1080
  * Get user's full name.
1084
1081
  */
@@ -1091,14 +1088,11 @@ type User = {
1091
1088
  * Get formatted username for display.
1092
1089
  */
1093
1090
  readonly display_username: string;
1094
- company?: string;
1095
- phone?: string;
1096
- position?: string;
1097
- language?: string;
1098
- /**
1099
- * IANA timezone name (e.g. 'Asia/Seoul'). Auto-detected from browser via X-Timezone header.
1100
- */
1101
- timezone?: string;
1091
+ company?: string | null;
1092
+ phone?: string | null;
1093
+ position?: string | null;
1094
+ language?: string | null;
1095
+ timezone?: string | null;
1102
1096
  readonly avatar: string | null;
1103
1097
  /**
1104
1098
  * Staff status
@@ -1231,31 +1225,25 @@ type TokenRefreshWritable = {
1231
1225
  * User data returned after 2FA verification.
1232
1226
  */
1233
1227
  type TotpVerifyUserWritable = {
1234
- first_name?: string;
1235
- last_name?: string;
1236
- company?: string;
1237
- phone?: string;
1238
- position?: string;
1239
- language?: string;
1240
- /**
1241
- * IANA timezone name (e.g. 'Asia/Seoul'). Auto-detected from browser via X-Timezone header.
1242
- */
1243
- timezone?: string;
1228
+ first_name?: string | null;
1229
+ last_name?: string | null;
1230
+ company?: string | null;
1231
+ phone?: string | null;
1232
+ position?: string | null;
1233
+ language?: string | null;
1234
+ timezone?: string | null;
1244
1235
  };
1245
1236
  /**
1246
1237
  * Serializer for user details.
1247
1238
  */
1248
1239
  type UserWritable = {
1249
- first_name?: string;
1250
- last_name?: string;
1251
- company?: string;
1252
- phone?: string;
1253
- position?: string;
1254
- language?: string;
1255
- /**
1256
- * IANA timezone name (e.g. 'Asia/Seoul'). Auto-detected from browser via X-Timezone header.
1257
- */
1258
- timezone?: string;
1240
+ first_name?: string | null;
1241
+ last_name?: string | null;
1242
+ company?: string | null;
1243
+ phone?: string | null;
1244
+ position?: string | null;
1245
+ language?: string | null;
1246
+ timezone?: string | null;
1259
1247
  };
1260
1248
  /**
1261
1249
  * Response serializer for successful 2FA verification.
package/dist/index.d.ts CHANGED
@@ -1031,8 +1031,8 @@ type TokenRefreshRequest = {
1031
1031
  type TotpVerifyUser = {
1032
1032
  readonly id: number;
1033
1033
  readonly email: string;
1034
- first_name?: string;
1035
- last_name?: string;
1034
+ first_name?: string | null;
1035
+ last_name?: string | null;
1036
1036
  /**
1037
1037
  * Get user's full name.
1038
1038
  */
@@ -1045,14 +1045,11 @@ type TotpVerifyUser = {
1045
1045
  * Get formatted username for display.
1046
1046
  */
1047
1047
  readonly display_username: string;
1048
- company?: string;
1049
- phone?: string;
1050
- position?: string;
1051
- language?: string;
1052
- /**
1053
- * IANA timezone name (e.g. 'Asia/Seoul'). Auto-detected from browser via X-Timezone header.
1054
- */
1055
- timezone?: string;
1048
+ company?: string | null;
1049
+ phone?: string | null;
1050
+ position?: string | null;
1051
+ language?: string | null;
1052
+ timezone?: string | null;
1056
1053
  readonly avatar: string | null;
1057
1054
  /**
1058
1055
  * Staff status
@@ -1077,8 +1074,8 @@ type TotpVerifyUser = {
1077
1074
  type User = {
1078
1075
  readonly id: number;
1079
1076
  readonly email: string;
1080
- first_name?: string;
1081
- last_name?: string;
1077
+ first_name?: string | null;
1078
+ last_name?: string | null;
1082
1079
  /**
1083
1080
  * Get user's full name.
1084
1081
  */
@@ -1091,14 +1088,11 @@ type User = {
1091
1088
  * Get formatted username for display.
1092
1089
  */
1093
1090
  readonly display_username: string;
1094
- company?: string;
1095
- phone?: string;
1096
- position?: string;
1097
- language?: string;
1098
- /**
1099
- * IANA timezone name (e.g. 'Asia/Seoul'). Auto-detected from browser via X-Timezone header.
1100
- */
1101
- timezone?: string;
1091
+ company?: string | null;
1092
+ phone?: string | null;
1093
+ position?: string | null;
1094
+ language?: string | null;
1095
+ timezone?: string | null;
1102
1096
  readonly avatar: string | null;
1103
1097
  /**
1104
1098
  * Staff status
@@ -1231,31 +1225,25 @@ type TokenRefreshWritable = {
1231
1225
  * User data returned after 2FA verification.
1232
1226
  */
1233
1227
  type TotpVerifyUserWritable = {
1234
- first_name?: string;
1235
- last_name?: string;
1236
- company?: string;
1237
- phone?: string;
1238
- position?: string;
1239
- language?: string;
1240
- /**
1241
- * IANA timezone name (e.g. 'Asia/Seoul'). Auto-detected from browser via X-Timezone header.
1242
- */
1243
- timezone?: string;
1228
+ first_name?: string | null;
1229
+ last_name?: string | null;
1230
+ company?: string | null;
1231
+ phone?: string | null;
1232
+ position?: string | null;
1233
+ language?: string | null;
1234
+ timezone?: string | null;
1244
1235
  };
1245
1236
  /**
1246
1237
  * Serializer for user details.
1247
1238
  */
1248
1239
  type UserWritable = {
1249
- first_name?: string;
1250
- last_name?: string;
1251
- company?: string;
1252
- phone?: string;
1253
- position?: string;
1254
- language?: string;
1255
- /**
1256
- * IANA timezone name (e.g. 'Asia/Seoul'). Auto-detected from browser via X-Timezone header.
1257
- */
1258
- timezone?: string;
1240
+ first_name?: string | null;
1241
+ last_name?: string | null;
1242
+ company?: string | null;
1243
+ phone?: string | null;
1244
+ position?: string | null;
1245
+ language?: string | null;
1246
+ timezone?: string | null;
1259
1247
  };
1260
1248
  /**
1261
1249
  * Response serializer for successful 2FA verification.
package/dist/index.mjs CHANGED
@@ -1,6 +1,77 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
3
 
4
+ // src/_api/generated/helpers/errors.ts
5
+ var APIError = class extends Error {
6
+ constructor(statusCode, statusText, response, url, message) {
7
+ super(message || `HTTP ${statusCode}: ${statusText}`);
8
+ this.statusCode = statusCode;
9
+ this.statusText = statusText;
10
+ this.response = response;
11
+ this.url = url;
12
+ this.name = "APIError";
13
+ }
14
+ static {
15
+ __name(this, "APIError");
16
+ }
17
+ get details() {
18
+ if (typeof this.response === "object" && this.response !== null) {
19
+ return this.response;
20
+ }
21
+ return null;
22
+ }
23
+ get fieldErrors() {
24
+ const details = this.details;
25
+ if (!details) return null;
26
+ const fieldErrors = {};
27
+ for (const [key, value] of Object.entries(details)) {
28
+ if (Array.isArray(value)) fieldErrors[key] = value;
29
+ }
30
+ return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
31
+ }
32
+ get errorMessage() {
33
+ const details = this.details;
34
+ if (!details) return this.message;
35
+ if (details.detail) {
36
+ return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
37
+ }
38
+ if (details.error) return String(details.error);
39
+ if (details.message) return String(details.message);
40
+ const fieldErrors = this.fieldErrors;
41
+ if (fieldErrors) {
42
+ const firstField = Object.keys(fieldErrors)[0];
43
+ if (firstField) return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
44
+ }
45
+ return this.message;
46
+ }
47
+ get isValidationError() {
48
+ return this.statusCode === 400;
49
+ }
50
+ get isAuthError() {
51
+ return this.statusCode === 401;
52
+ }
53
+ get isPermissionError() {
54
+ return this.statusCode === 403;
55
+ }
56
+ get isNotFoundError() {
57
+ return this.statusCode === 404;
58
+ }
59
+ get isServerError() {
60
+ return this.statusCode >= 500 && this.statusCode < 600;
61
+ }
62
+ };
63
+ var NetworkError = class extends Error {
64
+ constructor(message, url, originalError) {
65
+ super(message);
66
+ this.url = url;
67
+ this.originalError = originalError;
68
+ this.name = "NetworkError";
69
+ }
70
+ static {
71
+ __name(this, "NetworkError");
72
+ }
73
+ };
74
+
4
75
  // src/_api/generated/helpers/auth.ts
5
76
  var ACCESS_KEY = "cfg.access_token";
6
77
  var REFRESH_KEY = "cfg.refresh_token";
@@ -243,6 +314,13 @@ function installAuthOnClient(client2) {
243
314
  request.headers.set("X-Client-Time", (/* @__PURE__ */ new Date()).toISOString());
244
315
  return request;
245
316
  });
317
+ client2.interceptors.error.use((err, res, req) => {
318
+ if (err instanceof APIError) return err;
319
+ const url = req?.url ?? "";
320
+ const status = res?.status ?? 0;
321
+ const statusText = res?.statusText ?? "";
322
+ return new APIError(status, statusText, err, url);
323
+ });
246
324
  client2.interceptors.response.use(async (response, request) => {
247
325
  if (response.status !== 401) return response;
248
326
  if (request.headers.get(RETRY_MARKER)) {
@@ -1868,77 +1946,6 @@ var CookieStorageAdapter = class {
1868
1946
  }
1869
1947
  };
1870
1948
 
1871
- // src/_api/generated/helpers/errors.ts
1872
- var APIError = class extends Error {
1873
- constructor(statusCode, statusText, response, url, message) {
1874
- super(message || `HTTP ${statusCode}: ${statusText}`);
1875
- this.statusCode = statusCode;
1876
- this.statusText = statusText;
1877
- this.response = response;
1878
- this.url = url;
1879
- this.name = "APIError";
1880
- }
1881
- static {
1882
- __name(this, "APIError");
1883
- }
1884
- get details() {
1885
- if (typeof this.response === "object" && this.response !== null) {
1886
- return this.response;
1887
- }
1888
- return null;
1889
- }
1890
- get fieldErrors() {
1891
- const details = this.details;
1892
- if (!details) return null;
1893
- const fieldErrors = {};
1894
- for (const [key, value] of Object.entries(details)) {
1895
- if (Array.isArray(value)) fieldErrors[key] = value;
1896
- }
1897
- return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
1898
- }
1899
- get errorMessage() {
1900
- const details = this.details;
1901
- if (!details) return this.message;
1902
- if (details.detail) {
1903
- return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
1904
- }
1905
- if (details.error) return String(details.error);
1906
- if (details.message) return String(details.message);
1907
- const fieldErrors = this.fieldErrors;
1908
- if (fieldErrors) {
1909
- const firstField = Object.keys(fieldErrors)[0];
1910
- if (firstField) return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
1911
- }
1912
- return this.message;
1913
- }
1914
- get isValidationError() {
1915
- return this.statusCode === 400;
1916
- }
1917
- get isAuthError() {
1918
- return this.statusCode === 401;
1919
- }
1920
- get isPermissionError() {
1921
- return this.statusCode === 403;
1922
- }
1923
- get isNotFoundError() {
1924
- return this.statusCode === 404;
1925
- }
1926
- get isServerError() {
1927
- return this.statusCode >= 500 && this.statusCode < 600;
1928
- }
1929
- };
1930
- var NetworkError = class extends Error {
1931
- constructor(message, url, originalError) {
1932
- super(message);
1933
- this.url = url;
1934
- this.originalError = originalError;
1935
- this.name = "NetworkError";
1936
- }
1937
- static {
1938
- __name(this, "NetworkError");
1939
- }
1940
- };
1941
-
1942
1949
  // src/_api/generated/helpers/validation-events.ts
1943
1950
  function dispatchValidationError(detail) {
1944
1951
  if (typeof window === "undefined") return;