@djangocfg/api 2.1.421 → 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/auth-server.mjs
CHANGED
|
@@ -148,6 +148,18 @@ function detectLocale() {
|
|
|
148
148
|
}
|
|
149
149
|
__name(detectLocale, "detectLocale");
|
|
150
150
|
function defaultBaseUrl() {
|
|
151
|
+
if (typeof window !== "undefined") {
|
|
152
|
+
try {
|
|
153
|
+
if (typeof process !== "undefined" && process.env) {
|
|
154
|
+
if (process.env.NEXT_PUBLIC_STATIC_BUILD === "true") return "";
|
|
155
|
+
if (process.env.NEXT_PUBLIC_API_PROXY_URL !== void 0)
|
|
156
|
+
return process.env.NEXT_PUBLIC_API_PROXY_URL;
|
|
157
|
+
return process.env.NEXT_PUBLIC_API_URL || "";
|
|
158
|
+
}
|
|
159
|
+
} catch {
|
|
160
|
+
}
|
|
161
|
+
return "";
|
|
162
|
+
}
|
|
151
163
|
try {
|
|
152
164
|
if (typeof process !== "undefined" && process.env) {
|
|
153
165
|
if (process.env.NEXT_PUBLIC_STATIC_BUILD === "true") return "";
|
|
@@ -159,7 +171,6 @@ function defaultBaseUrl() {
|
|
|
159
171
|
}
|
|
160
172
|
__name(defaultBaseUrl, "defaultBaseUrl");
|
|
161
173
|
function defaultApiKey() {
|
|
162
|
-
if (isBrowser) return null;
|
|
163
174
|
try {
|
|
164
175
|
if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_API_KEY) {
|
|
165
176
|
return process.env.NEXT_PUBLIC_API_KEY;
|
|
@@ -315,7 +326,7 @@ function installAuthOnClient(client2) {
|
|
|
315
326
|
const locale = auth.getLocale();
|
|
316
327
|
if (locale) request.headers.set("Accept-Language", locale);
|
|
317
328
|
const apiKey = auth.getApiKey();
|
|
318
|
-
if (apiKey) request.headers.set("X-API-Key", apiKey);
|
|
329
|
+
if (apiKey && !request.headers.has("X-API-Key")) request.headers.set("X-API-Key", apiKey);
|
|
319
330
|
try {
|
|
320
331
|
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
321
332
|
if (tz) request.headers.set("X-Timezone", tz);
|
|
@@ -954,11 +965,8 @@ var checkForExistence = /* @__PURE__ */ __name((options, name) => {
|
|
|
954
965
|
}
|
|
955
966
|
return false;
|
|
956
967
|
}, "checkForExistence");
|
|
957
|
-
|
|
958
|
-
security
|
|
959
|
-
...options
|
|
960
|
-
}) => {
|
|
961
|
-
for (const auth2 of security) {
|
|
968
|
+
async function setAuthParams(options) {
|
|
969
|
+
for (const auth2 of options.security ?? []) {
|
|
962
970
|
if (checkForExistence(options, auth2.name)) {
|
|
963
971
|
continue;
|
|
964
972
|
}
|
|
@@ -983,7 +991,8 @@ var setAuthParams = /* @__PURE__ */ __name(async ({
|
|
|
983
991
|
break;
|
|
984
992
|
}
|
|
985
993
|
}
|
|
986
|
-
}
|
|
994
|
+
}
|
|
995
|
+
__name(setAuthParams, "setAuthParams");
|
|
987
996
|
var buildUrl = /* @__PURE__ */ __name((options) => getUrl({
|
|
988
997
|
baseUrl: options.baseUrl,
|
|
989
998
|
path: options.path,
|
|
@@ -1112,10 +1121,7 @@ var createClient = /* @__PURE__ */ __name((config = {}) => {
|
|
|
1112
1121
|
serializedBody: void 0
|
|
1113
1122
|
};
|
|
1114
1123
|
if (opts.security) {
|
|
1115
|
-
await setAuthParams(
|
|
1116
|
-
...opts,
|
|
1117
|
-
security: opts.security
|
|
1118
|
-
});
|
|
1124
|
+
await setAuthParams(opts);
|
|
1119
1125
|
}
|
|
1120
1126
|
if (opts.requestValidator) {
|
|
1121
1127
|
await opts.requestValidator(opts);
|
|
@@ -1308,11 +1314,15 @@ var CfgAccountsApiKey = class {
|
|
|
1308
1314
|
*/
|
|
1309
1315
|
static cfgAccountsApiKeyRetrieve(options) {
|
|
1310
1316
|
return (options?.client ?? client).get({
|
|
1311
|
-
security: [
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1317
|
+
security: [
|
|
1318
|
+
{ scheme: "bearer", type: "http" },
|
|
1319
|
+
{
|
|
1320
|
+
in: "cookie",
|
|
1321
|
+
name: "sessionid",
|
|
1322
|
+
type: "apiKey"
|
|
1323
|
+
},
|
|
1324
|
+
{ name: "X-API-Key", type: "apiKey" }
|
|
1325
|
+
],
|
|
1316
1326
|
url: "/cfg/accounts/api-key/",
|
|
1317
1327
|
...options
|
|
1318
1328
|
});
|
|
@@ -1324,11 +1334,15 @@ var CfgAccountsApiKey = class {
|
|
|
1324
1334
|
*/
|
|
1325
1335
|
static cfgAccountsApiKeyRegenerateCreate(options) {
|
|
1326
1336
|
return (options.client ?? client).post({
|
|
1327
|
-
security: [
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1337
|
+
security: [
|
|
1338
|
+
{ scheme: "bearer", type: "http" },
|
|
1339
|
+
{
|
|
1340
|
+
in: "cookie",
|
|
1341
|
+
name: "sessionid",
|
|
1342
|
+
type: "apiKey"
|
|
1343
|
+
},
|
|
1344
|
+
{ name: "X-API-Key", type: "apiKey" }
|
|
1345
|
+
],
|
|
1332
1346
|
url: "/cfg/accounts/api-key/regenerate/",
|
|
1333
1347
|
...options,
|
|
1334
1348
|
headers: {
|
|
@@ -1344,11 +1358,15 @@ var CfgAccountsApiKey = class {
|
|
|
1344
1358
|
*/
|
|
1345
1359
|
static cfgAccountsApiKeyTestCreate(options) {
|
|
1346
1360
|
return (options.client ?? client).post({
|
|
1347
|
-
security: [
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1361
|
+
security: [
|
|
1362
|
+
{ scheme: "bearer", type: "http" },
|
|
1363
|
+
{
|
|
1364
|
+
in: "cookie",
|
|
1365
|
+
name: "sessionid",
|
|
1366
|
+
type: "apiKey"
|
|
1367
|
+
},
|
|
1368
|
+
{ name: "X-API-Key", type: "apiKey" }
|
|
1369
|
+
],
|
|
1352
1370
|
url: "/cfg/accounts/api-key/test/",
|
|
1353
1371
|
...options,
|
|
1354
1372
|
headers: {
|