@djangocfg/api 2.1.421 → 2.1.423

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 (45) hide show
  1. package/dist/auth-server.cjs +45 -27
  2. package/dist/auth-server.cjs.map +1 -1
  3. package/dist/auth-server.mjs +45 -27
  4. package/dist/auth-server.mjs.map +1 -1
  5. package/dist/auth.cjs +61 -33
  6. package/dist/auth.cjs.map +1 -1
  7. package/dist/auth.d.cts +2 -1
  8. package/dist/auth.d.ts +2 -1
  9. package/dist/auth.mjs +61 -33
  10. package/dist/auth.mjs.map +1 -1
  11. package/dist/clients.cjs +45 -27
  12. package/dist/clients.cjs.map +1 -1
  13. package/dist/clients.d.cts +1 -1
  14. package/dist/clients.d.ts +1 -1
  15. package/dist/clients.mjs +45 -27
  16. package/dist/clients.mjs.map +1 -1
  17. package/dist/hooks.cjs +48 -29
  18. package/dist/hooks.cjs.map +1 -1
  19. package/dist/hooks.mjs +48 -29
  20. package/dist/hooks.mjs.map +1 -1
  21. package/dist/index.cjs +45 -27
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +2 -2
  24. package/dist/index.d.ts +2 -2
  25. package/dist/index.mjs +45 -27
  26. package/dist/index.mjs.map +1 -1
  27. package/package.json +2 -2
  28. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRetrieve.ts +12 -3
  29. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthConnectionsList.ts +12 -3
  30. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthProvidersRetrieve.ts +12 -3
  31. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileRetrieve.ts +12 -3
  32. package/src/_api/generated/_cfg_accounts/openapi.json +9 -0
  33. package/src/_api/generated/_cfg_centrifugo/hooks/useCfgCentrifugoAuthTokenRetrieve.ts +12 -3
  34. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpBackupCodesRetrieve.ts +12 -3
  35. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDevicesRetrieve.ts +12 -3
  36. package/src/_api/generated/client/client.gen.ts +1 -4
  37. package/src/_api/generated/client/types.gen.ts +3 -2
  38. package/src/_api/generated/client/utils.gen.ts +6 -8
  39. package/src/_api/generated/core/params.gen.ts +4 -4
  40. package/src/_api/generated/helpers/auth.ts +58 -9
  41. package/src/_api/generated/index.ts +6 -0
  42. package/src/_api/generated/openapi.json +9 -0
  43. package/src/_api/generated/sdk.gen.ts +18 -6
  44. package/src/auth/hooks/useAuthForm.ts +5 -4
  45. 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
- var setAuthParams = /* @__PURE__ */ __name(async ({
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
- }, "setAuthParams");
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: [{ scheme: "bearer", type: "http" }, {
1321
- in: "cookie",
1322
- name: "sessionid",
1323
- type: "apiKey"
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: [{ scheme: "bearer", type: "http" }, {
1337
- in: "cookie",
1338
- name: "sessionid",
1339
- type: "apiKey"
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: [{ scheme: "bearer", type: "http" }, {
1357
- in: "cookie",
1358
- name: "sessionid",
1359
- type: "apiKey"
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: {