@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/clients.d.cts
CHANGED
|
@@ -342,7 +342,7 @@ interface ClientOptions {
|
|
|
342
342
|
throwOnError?: boolean;
|
|
343
343
|
}
|
|
344
344
|
type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
345
|
-
type SseFn = <TData = unknown,
|
|
345
|
+
type SseFn = <TData = unknown, _TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData>>;
|
|
346
346
|
type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
347
347
|
type BuildUrlFn = <TData extends {
|
|
348
348
|
body?: unknown;
|
package/dist/clients.d.ts
CHANGED
|
@@ -342,7 +342,7 @@ interface ClientOptions {
|
|
|
342
342
|
throwOnError?: boolean;
|
|
343
343
|
}
|
|
344
344
|
type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
345
|
-
type SseFn = <TData = unknown,
|
|
345
|
+
type SseFn = <TData = unknown, _TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData>>;
|
|
346
346
|
type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
|
|
347
347
|
type BuildUrlFn = <TData extends {
|
|
348
348
|
body?: unknown;
|
package/dist/clients.mjs
CHANGED
|
@@ -129,6 +129,18 @@ function detectLocale() {
|
|
|
129
129
|
}
|
|
130
130
|
__name(detectLocale, "detectLocale");
|
|
131
131
|
function defaultBaseUrl() {
|
|
132
|
+
if (typeof window !== "undefined") {
|
|
133
|
+
try {
|
|
134
|
+
if (typeof process !== "undefined" && process.env) {
|
|
135
|
+
if (process.env.NEXT_PUBLIC_STATIC_BUILD === "true") return "";
|
|
136
|
+
if (process.env.NEXT_PUBLIC_API_PROXY_URL !== void 0)
|
|
137
|
+
return process.env.NEXT_PUBLIC_API_PROXY_URL;
|
|
138
|
+
return process.env.NEXT_PUBLIC_API_URL || "";
|
|
139
|
+
}
|
|
140
|
+
} catch {
|
|
141
|
+
}
|
|
142
|
+
return "";
|
|
143
|
+
}
|
|
132
144
|
try {
|
|
133
145
|
if (typeof process !== "undefined" && process.env) {
|
|
134
146
|
if (process.env.NEXT_PUBLIC_STATIC_BUILD === "true") return "";
|
|
@@ -140,7 +152,6 @@ function defaultBaseUrl() {
|
|
|
140
152
|
}
|
|
141
153
|
__name(defaultBaseUrl, "defaultBaseUrl");
|
|
142
154
|
function defaultApiKey() {
|
|
143
|
-
if (isBrowser) return null;
|
|
144
155
|
try {
|
|
145
156
|
if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_API_KEY) {
|
|
146
157
|
return process.env.NEXT_PUBLIC_API_KEY;
|
|
@@ -296,7 +307,7 @@ function installAuthOnClient(client2) {
|
|
|
296
307
|
const locale = auth.getLocale();
|
|
297
308
|
if (locale) request.headers.set("Accept-Language", locale);
|
|
298
309
|
const apiKey = auth.getApiKey();
|
|
299
|
-
if (apiKey) request.headers.set("X-API-Key", apiKey);
|
|
310
|
+
if (apiKey && !request.headers.has("X-API-Key")) request.headers.set("X-API-Key", apiKey);
|
|
300
311
|
try {
|
|
301
312
|
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
302
313
|
if (tz) request.headers.set("X-Timezone", tz);
|
|
@@ -935,11 +946,8 @@ var checkForExistence = /* @__PURE__ */ __name((options, name) => {
|
|
|
935
946
|
}
|
|
936
947
|
return false;
|
|
937
948
|
}, "checkForExistence");
|
|
938
|
-
|
|
939
|
-
security
|
|
940
|
-
...options
|
|
941
|
-
}) => {
|
|
942
|
-
for (const auth2 of security) {
|
|
949
|
+
async function setAuthParams(options) {
|
|
950
|
+
for (const auth2 of options.security ?? []) {
|
|
943
951
|
if (checkForExistence(options, auth2.name)) {
|
|
944
952
|
continue;
|
|
945
953
|
}
|
|
@@ -964,7 +972,8 @@ var setAuthParams = /* @__PURE__ */ __name(async ({
|
|
|
964
972
|
break;
|
|
965
973
|
}
|
|
966
974
|
}
|
|
967
|
-
}
|
|
975
|
+
}
|
|
976
|
+
__name(setAuthParams, "setAuthParams");
|
|
968
977
|
var buildUrl = /* @__PURE__ */ __name((options) => getUrl({
|
|
969
978
|
baseUrl: options.baseUrl,
|
|
970
979
|
path: options.path,
|
|
@@ -1093,10 +1102,7 @@ var createClient = /* @__PURE__ */ __name((config = {}) => {
|
|
|
1093
1102
|
serializedBody: void 0
|
|
1094
1103
|
};
|
|
1095
1104
|
if (opts.security) {
|
|
1096
|
-
await setAuthParams(
|
|
1097
|
-
...opts,
|
|
1098
|
-
security: opts.security
|
|
1099
|
-
});
|
|
1105
|
+
await setAuthParams(opts);
|
|
1100
1106
|
}
|
|
1101
1107
|
if (opts.requestValidator) {
|
|
1102
1108
|
await opts.requestValidator(opts);
|
|
@@ -1289,11 +1295,15 @@ var CfgAccountsApiKey = class {
|
|
|
1289
1295
|
*/
|
|
1290
1296
|
static cfgAccountsApiKeyRetrieve(options) {
|
|
1291
1297
|
return (options?.client ?? client).get({
|
|
1292
|
-
security: [
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1298
|
+
security: [
|
|
1299
|
+
{ scheme: "bearer", type: "http" },
|
|
1300
|
+
{
|
|
1301
|
+
in: "cookie",
|
|
1302
|
+
name: "sessionid",
|
|
1303
|
+
type: "apiKey"
|
|
1304
|
+
},
|
|
1305
|
+
{ name: "X-API-Key", type: "apiKey" }
|
|
1306
|
+
],
|
|
1297
1307
|
url: "/cfg/accounts/api-key/",
|
|
1298
1308
|
...options
|
|
1299
1309
|
});
|
|
@@ -1305,11 +1315,15 @@ var CfgAccountsApiKey = class {
|
|
|
1305
1315
|
*/
|
|
1306
1316
|
static cfgAccountsApiKeyRegenerateCreate(options) {
|
|
1307
1317
|
return (options.client ?? client).post({
|
|
1308
|
-
security: [
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1318
|
+
security: [
|
|
1319
|
+
{ scheme: "bearer", type: "http" },
|
|
1320
|
+
{
|
|
1321
|
+
in: "cookie",
|
|
1322
|
+
name: "sessionid",
|
|
1323
|
+
type: "apiKey"
|
|
1324
|
+
},
|
|
1325
|
+
{ name: "X-API-Key", type: "apiKey" }
|
|
1326
|
+
],
|
|
1313
1327
|
url: "/cfg/accounts/api-key/regenerate/",
|
|
1314
1328
|
...options,
|
|
1315
1329
|
headers: {
|
|
@@ -1325,11 +1339,15 @@ var CfgAccountsApiKey = class {
|
|
|
1325
1339
|
*/
|
|
1326
1340
|
static cfgAccountsApiKeyTestCreate(options) {
|
|
1327
1341
|
return (options.client ?? client).post({
|
|
1328
|
-
security: [
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1342
|
+
security: [
|
|
1343
|
+
{ scheme: "bearer", type: "http" },
|
|
1344
|
+
{
|
|
1345
|
+
in: "cookie",
|
|
1346
|
+
name: "sessionid",
|
|
1347
|
+
type: "apiKey"
|
|
1348
|
+
},
|
|
1349
|
+
{ name: "X-API-Key", type: "apiKey" }
|
|
1350
|
+
],
|
|
1333
1351
|
url: "/cfg/accounts/api-key/test/",
|
|
1334
1352
|
...options,
|
|
1335
1353
|
headers: {
|