@djangocfg/api 2.1.359 → 2.1.361
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 +68 -0
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +68 -0
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +75 -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 +75 -67
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +68 -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 +68 -0
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +68 -0
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.mjs +68 -0
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +79 -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 +79 -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/openapi.json +1811 -0
- 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_centrifugo/openapi.json +132 -0
- 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/openapi.json +927 -0
- package/src/_api/generated/_cfg_totp/schemas/TotpVerifyUser.ts +7 -7
- package/src/_api/generated/helpers/auth.ts +27 -2
- package/src/_api/generated/openapi.json +2789 -0
- package/src/_api/generated/types.gen.ts +28 -40
package/dist/auth.d.cts
CHANGED
|
@@ -152,8 +152,8 @@ type TokenRefresh = {
|
|
|
152
152
|
type User = {
|
|
153
153
|
readonly id: number;
|
|
154
154
|
readonly email: string;
|
|
155
|
-
first_name?: string;
|
|
156
|
-
last_name?: string;
|
|
155
|
+
first_name?: string | null;
|
|
156
|
+
last_name?: string | null;
|
|
157
157
|
/**
|
|
158
158
|
* Get user's full name.
|
|
159
159
|
*/
|
|
@@ -166,14 +166,11 @@ type User = {
|
|
|
166
166
|
* Get formatted username for display.
|
|
167
167
|
*/
|
|
168
168
|
readonly display_username: string;
|
|
169
|
-
company?: string;
|
|
170
|
-
phone?: string;
|
|
171
|
-
position?: string;
|
|
172
|
-
language?: string;
|
|
173
|
-
|
|
174
|
-
* IANA timezone name (e.g. 'Asia/Seoul'). Auto-detected from browser via X-Timezone header.
|
|
175
|
-
*/
|
|
176
|
-
timezone?: string;
|
|
169
|
+
company?: string | null;
|
|
170
|
+
phone?: string | null;
|
|
171
|
+
position?: string | null;
|
|
172
|
+
language?: string | null;
|
|
173
|
+
timezone?: string | null;
|
|
177
174
|
readonly avatar: string | null;
|
|
178
175
|
/**
|
|
179
176
|
* Staff status
|
package/dist/auth.d.ts
CHANGED
|
@@ -152,8 +152,8 @@ type TokenRefresh = {
|
|
|
152
152
|
type User = {
|
|
153
153
|
readonly id: number;
|
|
154
154
|
readonly email: string;
|
|
155
|
-
first_name?: string;
|
|
156
|
-
last_name?: string;
|
|
155
|
+
first_name?: string | null;
|
|
156
|
+
last_name?: string | null;
|
|
157
157
|
/**
|
|
158
158
|
* Get user's full name.
|
|
159
159
|
*/
|
|
@@ -166,14 +166,11 @@ type User = {
|
|
|
166
166
|
* Get formatted username for display.
|
|
167
167
|
*/
|
|
168
168
|
readonly display_username: string;
|
|
169
|
-
company?: string;
|
|
170
|
-
phone?: string;
|
|
171
|
-
position?: string;
|
|
172
|
-
language?: string;
|
|
173
|
-
|
|
174
|
-
* IANA timezone name (e.g. 'Asia/Seoul'). Auto-detected from browser via X-Timezone header.
|
|
175
|
-
*/
|
|
176
|
-
timezone?: string;
|
|
169
|
+
company?: string | null;
|
|
170
|
+
phone?: string | null;
|
|
171
|
+
position?: string | null;
|
|
172
|
+
language?: string | null;
|
|
173
|
+
timezone?: string | null;
|
|
177
174
|
readonly avatar: string | null;
|
|
178
175
|
/**
|
|
179
176
|
* Staff status
|
package/dist/auth.mjs
CHANGED
|
@@ -262,6 +262,66 @@ var useAutoAuth = /* @__PURE__ */ __name((options = {}) => {
|
|
|
262
262
|
// src/auth/hooks/useTwoFactor.ts
|
|
263
263
|
import { useCallback as useCallback4, useState as useState3 } from "react";
|
|
264
264
|
|
|
265
|
+
// src/_api/generated/helpers/errors.ts
|
|
266
|
+
var APIError = class extends Error {
|
|
267
|
+
constructor(statusCode, statusText, response, url, message) {
|
|
268
|
+
super(message || `HTTP ${statusCode}: ${statusText}`);
|
|
269
|
+
this.statusCode = statusCode;
|
|
270
|
+
this.statusText = statusText;
|
|
271
|
+
this.response = response;
|
|
272
|
+
this.url = url;
|
|
273
|
+
this.name = "APIError";
|
|
274
|
+
}
|
|
275
|
+
static {
|
|
276
|
+
__name(this, "APIError");
|
|
277
|
+
}
|
|
278
|
+
get details() {
|
|
279
|
+
if (typeof this.response === "object" && this.response !== null) {
|
|
280
|
+
return this.response;
|
|
281
|
+
}
|
|
282
|
+
return null;
|
|
283
|
+
}
|
|
284
|
+
get fieldErrors() {
|
|
285
|
+
const details = this.details;
|
|
286
|
+
if (!details) return null;
|
|
287
|
+
const fieldErrors = {};
|
|
288
|
+
for (const [key, value] of Object.entries(details)) {
|
|
289
|
+
if (Array.isArray(value)) fieldErrors[key] = value;
|
|
290
|
+
}
|
|
291
|
+
return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
|
|
292
|
+
}
|
|
293
|
+
get errorMessage() {
|
|
294
|
+
const details = this.details;
|
|
295
|
+
if (!details) return this.message;
|
|
296
|
+
if (details.detail) {
|
|
297
|
+
return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
|
|
298
|
+
}
|
|
299
|
+
if (details.error) return String(details.error);
|
|
300
|
+
if (details.message) return String(details.message);
|
|
301
|
+
const fieldErrors = this.fieldErrors;
|
|
302
|
+
if (fieldErrors) {
|
|
303
|
+
const firstField = Object.keys(fieldErrors)[0];
|
|
304
|
+
if (firstField) return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
|
|
305
|
+
}
|
|
306
|
+
return this.message;
|
|
307
|
+
}
|
|
308
|
+
get isValidationError() {
|
|
309
|
+
return this.statusCode === 400;
|
|
310
|
+
}
|
|
311
|
+
get isAuthError() {
|
|
312
|
+
return this.statusCode === 401;
|
|
313
|
+
}
|
|
314
|
+
get isPermissionError() {
|
|
315
|
+
return this.statusCode === 403;
|
|
316
|
+
}
|
|
317
|
+
get isNotFoundError() {
|
|
318
|
+
return this.statusCode === 404;
|
|
319
|
+
}
|
|
320
|
+
get isServerError() {
|
|
321
|
+
return this.statusCode >= 500 && this.statusCode < 600;
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
|
|
265
325
|
// src/_api/generated/helpers/auth.ts
|
|
266
326
|
var ACCESS_KEY = "cfg.access_token";
|
|
267
327
|
var REFRESH_KEY = "cfg.refresh_token";
|
|
@@ -340,6 +400,7 @@ function defaultBaseUrl() {
|
|
|
340
400
|
}
|
|
341
401
|
__name(defaultBaseUrl, "defaultBaseUrl");
|
|
342
402
|
function defaultApiKey() {
|
|
403
|
+
if (isBrowser2) return null;
|
|
343
404
|
try {
|
|
344
405
|
if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_API_KEY) {
|
|
345
406
|
return process.env.NEXT_PUBLIC_API_KEY;
|
|
@@ -504,6 +565,13 @@ function installAuthOnClient(client2) {
|
|
|
504
565
|
request.headers.set("X-Client-Time", (/* @__PURE__ */ new Date()).toISOString());
|
|
505
566
|
return request;
|
|
506
567
|
});
|
|
568
|
+
client2.interceptors.error.use((err, res, req) => {
|
|
569
|
+
if (err instanceof APIError) return err;
|
|
570
|
+
const url = req?.url ?? "";
|
|
571
|
+
const status = res?.status ?? 0;
|
|
572
|
+
const statusText = res?.statusText ?? "";
|
|
573
|
+
return new APIError(status, statusText, err, url);
|
|
574
|
+
});
|
|
507
575
|
client2.interceptors.response.use(async (response, request) => {
|
|
508
576
|
if (response.status !== 401) return response;
|
|
509
577
|
if (request.headers.get(RETRY_MARKER)) {
|
|
@@ -2039,66 +2107,6 @@ var API = class {
|
|
|
2039
2107
|
}
|
|
2040
2108
|
};
|
|
2041
2109
|
|
|
2042
|
-
// src/_api/generated/helpers/errors.ts
|
|
2043
|
-
var APIError = class extends Error {
|
|
2044
|
-
constructor(statusCode, statusText, response, url, message) {
|
|
2045
|
-
super(message || `HTTP ${statusCode}: ${statusText}`);
|
|
2046
|
-
this.statusCode = statusCode;
|
|
2047
|
-
this.statusText = statusText;
|
|
2048
|
-
this.response = response;
|
|
2049
|
-
this.url = url;
|
|
2050
|
-
this.name = "APIError";
|
|
2051
|
-
}
|
|
2052
|
-
static {
|
|
2053
|
-
__name(this, "APIError");
|
|
2054
|
-
}
|
|
2055
|
-
get details() {
|
|
2056
|
-
if (typeof this.response === "object" && this.response !== null) {
|
|
2057
|
-
return this.response;
|
|
2058
|
-
}
|
|
2059
|
-
return null;
|
|
2060
|
-
}
|
|
2061
|
-
get fieldErrors() {
|
|
2062
|
-
const details = this.details;
|
|
2063
|
-
if (!details) return null;
|
|
2064
|
-
const fieldErrors = {};
|
|
2065
|
-
for (const [key, value] of Object.entries(details)) {
|
|
2066
|
-
if (Array.isArray(value)) fieldErrors[key] = value;
|
|
2067
|
-
}
|
|
2068
|
-
return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
|
|
2069
|
-
}
|
|
2070
|
-
get errorMessage() {
|
|
2071
|
-
const details = this.details;
|
|
2072
|
-
if (!details) return this.message;
|
|
2073
|
-
if (details.detail) {
|
|
2074
|
-
return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
|
|
2075
|
-
}
|
|
2076
|
-
if (details.error) return String(details.error);
|
|
2077
|
-
if (details.message) return String(details.message);
|
|
2078
|
-
const fieldErrors = this.fieldErrors;
|
|
2079
|
-
if (fieldErrors) {
|
|
2080
|
-
const firstField = Object.keys(fieldErrors)[0];
|
|
2081
|
-
if (firstField) return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
|
|
2082
|
-
}
|
|
2083
|
-
return this.message;
|
|
2084
|
-
}
|
|
2085
|
-
get isValidationError() {
|
|
2086
|
-
return this.statusCode === 400;
|
|
2087
|
-
}
|
|
2088
|
-
get isAuthError() {
|
|
2089
|
-
return this.statusCode === 401;
|
|
2090
|
-
}
|
|
2091
|
-
get isPermissionError() {
|
|
2092
|
-
return this.statusCode === 403;
|
|
2093
|
-
}
|
|
2094
|
-
get isNotFoundError() {
|
|
2095
|
-
return this.statusCode === 404;
|
|
2096
|
-
}
|
|
2097
|
-
get isServerError() {
|
|
2098
|
-
return this.statusCode >= 500 && this.statusCode < 600;
|
|
2099
|
-
}
|
|
2100
|
-
};
|
|
2101
|
-
|
|
2102
2110
|
// src/_api/generated/_cfg_centrifugo/api.ts
|
|
2103
2111
|
var API2 = class {
|
|
2104
2112
|
static {
|
|
@@ -3837,16 +3845,16 @@ var CentrifugoTokenSchema = z12.object({
|
|
|
3837
3845
|
var UserSchema = z13.object({
|
|
3838
3846
|
id: z13.number().int(),
|
|
3839
3847
|
email: z13.email(),
|
|
3840
|
-
first_name: z13.string().max(50).optional(),
|
|
3841
|
-
last_name: z13.string().max(50).optional(),
|
|
3848
|
+
first_name: z13.string().max(50).nullable().optional(),
|
|
3849
|
+
last_name: z13.string().max(50).nullable().optional(),
|
|
3842
3850
|
full_name: z13.string(),
|
|
3843
3851
|
initials: z13.string(),
|
|
3844
3852
|
display_username: z13.string(),
|
|
3845
|
-
company: z13.string().max(100).optional(),
|
|
3846
|
-
phone: z13.string().max(20).optional(),
|
|
3847
|
-
position: z13.string().max(100).optional(),
|
|
3848
|
-
language: z13.string().max(10).optional(),
|
|
3849
|
-
timezone: z13.string().max(64).optional(),
|
|
3853
|
+
company: z13.string().max(100).nullable().optional(),
|
|
3854
|
+
phone: z13.string().max(20).nullable().optional(),
|
|
3855
|
+
position: z13.string().max(100).nullable().optional(),
|
|
3856
|
+
language: z13.string().max(10).nullable().optional(),
|
|
3857
|
+
timezone: z13.string().max(64).nullable().optional(),
|
|
3850
3858
|
avatar: z13.string().nullable(),
|
|
3851
3859
|
is_staff: z13.boolean(),
|
|
3852
3860
|
is_superuser: z13.boolean(),
|