@djangocfg/api 2.1.420 → 2.1.422
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 +45 -27
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +45 -27
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +61 -33
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +2 -1
- package/dist/auth.d.ts +2 -1
- package/dist/auth.mjs +61 -33
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +45 -27
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +1 -1
- package/dist/clients.d.ts +1 -1
- package/dist/clients.mjs +45 -27
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +48 -29
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.mjs +48 -29
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +45 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +45 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRetrieve.ts +12 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthConnectionsList.ts +12 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthProvidersRetrieve.ts +12 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileRetrieve.ts +12 -3
- package/src/_api/generated/_cfg_accounts/openapi.json +9 -0
- package/src/_api/generated/_cfg_centrifugo/hooks/useCfgCentrifugoAuthTokenRetrieve.ts +12 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpBackupCodesRetrieve.ts +12 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDevicesRetrieve.ts +12 -3
- package/src/_api/generated/client/client.gen.ts +1 -4
- package/src/_api/generated/client/types.gen.ts +3 -2
- package/src/_api/generated/client/utils.gen.ts +6 -8
- package/src/_api/generated/core/params.gen.ts +4 -4
- package/src/_api/generated/helpers/auth.ts +58 -9
- package/src/_api/generated/index.ts +6 -0
- package/src/_api/generated/openapi.json +9 -0
- package/src/_api/generated/sdk.gen.ts +18 -6
- package/src/auth/hooks/useAuthForm.ts +5 -4
- package/src/auth/hooks/useAutoAuth.ts +23 -4
package/dist/hooks.cjs
CHANGED
|
@@ -499,11 +499,8 @@ var checkForExistence = /* @__PURE__ */ __name((options, name) => {
|
|
|
499
499
|
}
|
|
500
500
|
return false;
|
|
501
501
|
}, "checkForExistence");
|
|
502
|
-
|
|
503
|
-
security
|
|
504
|
-
...options
|
|
505
|
-
}) => {
|
|
506
|
-
for (const auth2 of security) {
|
|
502
|
+
async function setAuthParams(options) {
|
|
503
|
+
for (const auth2 of options.security ?? []) {
|
|
507
504
|
if (checkForExistence(options, auth2.name)) {
|
|
508
505
|
continue;
|
|
509
506
|
}
|
|
@@ -528,7 +525,8 @@ var setAuthParams = /* @__PURE__ */ __name(async ({
|
|
|
528
525
|
break;
|
|
529
526
|
}
|
|
530
527
|
}
|
|
531
|
-
}
|
|
528
|
+
}
|
|
529
|
+
__name(setAuthParams, "setAuthParams");
|
|
532
530
|
var buildUrl = /* @__PURE__ */ __name((options) => getUrl({
|
|
533
531
|
baseUrl: options.baseUrl,
|
|
534
532
|
path: options.path,
|
|
@@ -657,10 +655,7 @@ var createClient = /* @__PURE__ */ __name((config = {}) => {
|
|
|
657
655
|
serializedBody: void 0
|
|
658
656
|
};
|
|
659
657
|
if (opts.security) {
|
|
660
|
-
await setAuthParams(
|
|
661
|
-
...opts,
|
|
662
|
-
security: opts.security
|
|
663
|
-
});
|
|
658
|
+
await setAuthParams(opts);
|
|
664
659
|
}
|
|
665
660
|
if (opts.requestValidator) {
|
|
666
661
|
await opts.requestValidator(opts);
|
|
@@ -964,6 +959,18 @@ function detectLocale() {
|
|
|
964
959
|
}
|
|
965
960
|
__name(detectLocale, "detectLocale");
|
|
966
961
|
function defaultBaseUrl() {
|
|
962
|
+
if (typeof window !== "undefined") {
|
|
963
|
+
try {
|
|
964
|
+
if (typeof process !== "undefined" && process.env) {
|
|
965
|
+
if (process.env.NEXT_PUBLIC_STATIC_BUILD === "true") return "";
|
|
966
|
+
if (process.env.NEXT_PUBLIC_API_PROXY_URL !== void 0)
|
|
967
|
+
return process.env.NEXT_PUBLIC_API_PROXY_URL;
|
|
968
|
+
return process.env.NEXT_PUBLIC_API_URL || "";
|
|
969
|
+
}
|
|
970
|
+
} catch {
|
|
971
|
+
}
|
|
972
|
+
return "";
|
|
973
|
+
}
|
|
967
974
|
try {
|
|
968
975
|
if (typeof process !== "undefined" && process.env) {
|
|
969
976
|
if (process.env.NEXT_PUBLIC_STATIC_BUILD === "true") return "";
|
|
@@ -975,7 +982,6 @@ function defaultBaseUrl() {
|
|
|
975
982
|
}
|
|
976
983
|
__name(defaultBaseUrl, "defaultBaseUrl");
|
|
977
984
|
function defaultApiKey() {
|
|
978
|
-
if (isBrowser) return null;
|
|
979
985
|
try {
|
|
980
986
|
if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_API_KEY) {
|
|
981
987
|
return process.env.NEXT_PUBLIC_API_KEY;
|
|
@@ -1131,7 +1137,7 @@ function installAuthOnClient(client2) {
|
|
|
1131
1137
|
const locale = auth.getLocale();
|
|
1132
1138
|
if (locale) request.headers.set("Accept-Language", locale);
|
|
1133
1139
|
const apiKey = auth.getApiKey();
|
|
1134
|
-
if (apiKey) request.headers.set("X-API-Key", apiKey);
|
|
1140
|
+
if (apiKey && !request.headers.has("X-API-Key")) request.headers.set("X-API-Key", apiKey);
|
|
1135
1141
|
try {
|
|
1136
1142
|
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1137
1143
|
if (tz) request.headers.set("X-Timezone", tz);
|
|
@@ -1209,11 +1215,15 @@ var CfgAccountsApiKey = class {
|
|
|
1209
1215
|
*/
|
|
1210
1216
|
static cfgAccountsApiKeyRetrieve(options) {
|
|
1211
1217
|
return (options?.client ?? client).get({
|
|
1212
|
-
security: [
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1218
|
+
security: [
|
|
1219
|
+
{ scheme: "bearer", type: "http" },
|
|
1220
|
+
{
|
|
1221
|
+
in: "cookie",
|
|
1222
|
+
name: "sessionid",
|
|
1223
|
+
type: "apiKey"
|
|
1224
|
+
},
|
|
1225
|
+
{ name: "X-API-Key", type: "apiKey" }
|
|
1226
|
+
],
|
|
1217
1227
|
url: "/cfg/accounts/api-key/",
|
|
1218
1228
|
...options
|
|
1219
1229
|
});
|
|
@@ -1225,11 +1235,15 @@ var CfgAccountsApiKey = class {
|
|
|
1225
1235
|
*/
|
|
1226
1236
|
static cfgAccountsApiKeyRegenerateCreate(options) {
|
|
1227
1237
|
return (options.client ?? client).post({
|
|
1228
|
-
security: [
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1238
|
+
security: [
|
|
1239
|
+
{ scheme: "bearer", type: "http" },
|
|
1240
|
+
{
|
|
1241
|
+
in: "cookie",
|
|
1242
|
+
name: "sessionid",
|
|
1243
|
+
type: "apiKey"
|
|
1244
|
+
},
|
|
1245
|
+
{ name: "X-API-Key", type: "apiKey" }
|
|
1246
|
+
],
|
|
1233
1247
|
url: "/cfg/accounts/api-key/regenerate/",
|
|
1234
1248
|
...options,
|
|
1235
1249
|
headers: {
|
|
@@ -1245,11 +1259,15 @@ var CfgAccountsApiKey = class {
|
|
|
1245
1259
|
*/
|
|
1246
1260
|
static cfgAccountsApiKeyTestCreate(options) {
|
|
1247
1261
|
return (options.client ?? client).post({
|
|
1248
|
-
security: [
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1262
|
+
security: [
|
|
1263
|
+
{ scheme: "bearer", type: "http" },
|
|
1264
|
+
{
|
|
1265
|
+
in: "cookie",
|
|
1266
|
+
name: "sessionid",
|
|
1267
|
+
type: "apiKey"
|
|
1268
|
+
},
|
|
1269
|
+
{ name: "X-API-Key", type: "apiKey" }
|
|
1270
|
+
],
|
|
1253
1271
|
url: "/cfg/accounts/api-key/test/",
|
|
1254
1272
|
...options,
|
|
1255
1273
|
headers: {
|
|
@@ -1327,7 +1345,8 @@ var APIKeySchema = import_zod2.z.object({
|
|
|
1327
1345
|
|
|
1328
1346
|
// src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRetrieve.ts
|
|
1329
1347
|
function useCfgAccountsApiKeyRetrieve(args, config) {
|
|
1330
|
-
const
|
|
1348
|
+
const { enabled = true, ...swrConfig } = config ?? {};
|
|
1349
|
+
const key = enabled ? ["cfg_accounts_api_key_retrieve", args ?? {}] : null;
|
|
1331
1350
|
return (0, import_swr.default)(
|
|
1332
1351
|
key,
|
|
1333
1352
|
async () => {
|
|
@@ -1368,7 +1387,7 @@ function useCfgAccountsApiKeyRetrieve(args, config) {
|
|
|
1368
1387
|
}
|
|
1369
1388
|
return parsed.data;
|
|
1370
1389
|
},
|
|
1371
|
-
|
|
1390
|
+
swrConfig
|
|
1372
1391
|
);
|
|
1373
1392
|
}
|
|
1374
1393
|
__name(useCfgAccountsApiKeyRetrieve, "useCfgAccountsApiKeyRetrieve");
|