@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/clients.cjs
CHANGED
|
@@ -157,6 +157,18 @@ function detectLocale() {
|
|
|
157
157
|
}
|
|
158
158
|
__name(detectLocale, "detectLocale");
|
|
159
159
|
function defaultBaseUrl() {
|
|
160
|
+
if (typeof window !== "undefined") {
|
|
161
|
+
try {
|
|
162
|
+
if (typeof process !== "undefined" && process.env) {
|
|
163
|
+
if (process.env.NEXT_PUBLIC_STATIC_BUILD === "true") return "";
|
|
164
|
+
if (process.env.NEXT_PUBLIC_API_PROXY_URL !== void 0)
|
|
165
|
+
return process.env.NEXT_PUBLIC_API_PROXY_URL;
|
|
166
|
+
return process.env.NEXT_PUBLIC_API_URL || "";
|
|
167
|
+
}
|
|
168
|
+
} catch {
|
|
169
|
+
}
|
|
170
|
+
return "";
|
|
171
|
+
}
|
|
160
172
|
try {
|
|
161
173
|
if (typeof process !== "undefined" && process.env) {
|
|
162
174
|
if (process.env.NEXT_PUBLIC_STATIC_BUILD === "true") return "";
|
|
@@ -168,7 +180,6 @@ function defaultBaseUrl() {
|
|
|
168
180
|
}
|
|
169
181
|
__name(defaultBaseUrl, "defaultBaseUrl");
|
|
170
182
|
function defaultApiKey() {
|
|
171
|
-
if (isBrowser) return null;
|
|
172
183
|
try {
|
|
173
184
|
if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_API_KEY) {
|
|
174
185
|
return process.env.NEXT_PUBLIC_API_KEY;
|
|
@@ -324,7 +335,7 @@ function installAuthOnClient(client2) {
|
|
|
324
335
|
const locale = auth.getLocale();
|
|
325
336
|
if (locale) request.headers.set("Accept-Language", locale);
|
|
326
337
|
const apiKey = auth.getApiKey();
|
|
327
|
-
if (apiKey) request.headers.set("X-API-Key", apiKey);
|
|
338
|
+
if (apiKey && !request.headers.has("X-API-Key")) request.headers.set("X-API-Key", apiKey);
|
|
328
339
|
try {
|
|
329
340
|
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
330
341
|
if (tz) request.headers.set("X-Timezone", tz);
|
|
@@ -963,11 +974,8 @@ var checkForExistence = /* @__PURE__ */ __name((options, name) => {
|
|
|
963
974
|
}
|
|
964
975
|
return false;
|
|
965
976
|
}, "checkForExistence");
|
|
966
|
-
|
|
967
|
-
security
|
|
968
|
-
...options
|
|
969
|
-
}) => {
|
|
970
|
-
for (const auth2 of security) {
|
|
977
|
+
async function setAuthParams(options) {
|
|
978
|
+
for (const auth2 of options.security ?? []) {
|
|
971
979
|
if (checkForExistence(options, auth2.name)) {
|
|
972
980
|
continue;
|
|
973
981
|
}
|
|
@@ -992,7 +1000,8 @@ var setAuthParams = /* @__PURE__ */ __name(async ({
|
|
|
992
1000
|
break;
|
|
993
1001
|
}
|
|
994
1002
|
}
|
|
995
|
-
}
|
|
1003
|
+
}
|
|
1004
|
+
__name(setAuthParams, "setAuthParams");
|
|
996
1005
|
var buildUrl = /* @__PURE__ */ __name((options) => getUrl({
|
|
997
1006
|
baseUrl: options.baseUrl,
|
|
998
1007
|
path: options.path,
|
|
@@ -1121,10 +1130,7 @@ var createClient = /* @__PURE__ */ __name((config = {}) => {
|
|
|
1121
1130
|
serializedBody: void 0
|
|
1122
1131
|
};
|
|
1123
1132
|
if (opts.security) {
|
|
1124
|
-
await setAuthParams(
|
|
1125
|
-
...opts,
|
|
1126
|
-
security: opts.security
|
|
1127
|
-
});
|
|
1133
|
+
await setAuthParams(opts);
|
|
1128
1134
|
}
|
|
1129
1135
|
if (opts.requestValidator) {
|
|
1130
1136
|
await opts.requestValidator(opts);
|
|
@@ -1317,11 +1323,15 @@ var CfgAccountsApiKey = class {
|
|
|
1317
1323
|
*/
|
|
1318
1324
|
static cfgAccountsApiKeyRetrieve(options) {
|
|
1319
1325
|
return (options?.client ?? client).get({
|
|
1320
|
-
security: [
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1326
|
+
security: [
|
|
1327
|
+
{ scheme: "bearer", type: "http" },
|
|
1328
|
+
{
|
|
1329
|
+
in: "cookie",
|
|
1330
|
+
name: "sessionid",
|
|
1331
|
+
type: "apiKey"
|
|
1332
|
+
},
|
|
1333
|
+
{ name: "X-API-Key", type: "apiKey" }
|
|
1334
|
+
],
|
|
1325
1335
|
url: "/cfg/accounts/api-key/",
|
|
1326
1336
|
...options
|
|
1327
1337
|
});
|
|
@@ -1333,11 +1343,15 @@ var CfgAccountsApiKey = class {
|
|
|
1333
1343
|
*/
|
|
1334
1344
|
static cfgAccountsApiKeyRegenerateCreate(options) {
|
|
1335
1345
|
return (options.client ?? client).post({
|
|
1336
|
-
security: [
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1346
|
+
security: [
|
|
1347
|
+
{ scheme: "bearer", type: "http" },
|
|
1348
|
+
{
|
|
1349
|
+
in: "cookie",
|
|
1350
|
+
name: "sessionid",
|
|
1351
|
+
type: "apiKey"
|
|
1352
|
+
},
|
|
1353
|
+
{ name: "X-API-Key", type: "apiKey" }
|
|
1354
|
+
],
|
|
1341
1355
|
url: "/cfg/accounts/api-key/regenerate/",
|
|
1342
1356
|
...options,
|
|
1343
1357
|
headers: {
|
|
@@ -1353,11 +1367,15 @@ var CfgAccountsApiKey = class {
|
|
|
1353
1367
|
*/
|
|
1354
1368
|
static cfgAccountsApiKeyTestCreate(options) {
|
|
1355
1369
|
return (options.client ?? client).post({
|
|
1356
|
-
security: [
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1370
|
+
security: [
|
|
1371
|
+
{ scheme: "bearer", type: "http" },
|
|
1372
|
+
{
|
|
1373
|
+
in: "cookie",
|
|
1374
|
+
name: "sessionid",
|
|
1375
|
+
type: "apiKey"
|
|
1376
|
+
},
|
|
1377
|
+
{ name: "X-API-Key", type: "apiKey" }
|
|
1378
|
+
],
|
|
1361
1379
|
url: "/cfg/accounts/api-key/test/",
|
|
1362
1380
|
...options,
|
|
1363
1381
|
headers: {
|