@djangocfg/api 2.1.327 → 2.1.331
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 +185 -3471
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +185 -3471
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +952 -3305
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +35 -35
- package/dist/auth.d.ts +35 -35
- package/dist/auth.mjs +952 -3305
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +90 -3396
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +4 -2508
- package/dist/clients.d.ts +4 -2508
- package/dist/clients.mjs +90 -3396
- package/dist/clients.mjs.map +1 -1
- package/dist/index.cjs +985 -3052
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1544 -1938
- package/dist/index.d.ts +1544 -1938
- package/dist/index.mjs +985 -3052
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_api/generated/{cfg_centrifugo → _cfg_accounts}/api.ts +11 -55
- package/src/_api/generated/{cfg_totp → _cfg_accounts}/events.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/index.ts +1 -1
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthConnectionsList.ts +5 -6
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthDisconnectCreate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthGithubAuthorizeCreate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthGithubCallbackCreate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthProvidersRetrieve.ts +5 -6
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOtpRequestCreate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOtpVerifyCreate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileAvatarCreate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileDeleteCreate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfilePartialPartialUpdate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfilePartialUpdate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileRetrieve.ts +5 -6
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileUpdatePartialUpdate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileUpdateUpdate.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsTokenRefreshCreate.ts +3 -3
- package/src/_api/generated/{cfg_centrifugo → _cfg_accounts}/index.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/AccountDeleteResponse.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/CentrifugoToken.ts +4 -4
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/CfgUserUpdateRequest.ts +4 -4
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthAuthorizeRequestRequest.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthAuthorizeResponse.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthCallbackRequestRequest.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthConnection.ts +6 -6
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthDisconnectRequestRequest.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthError.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthProvidersResponse.ts +3 -3
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthTokenResponse.ts +7 -7
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPErrorResponse.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPRequestRequest.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPRequestResponse.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPVerifyRequest.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPVerifyResponse.ts +6 -6
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/PatchedCfgUserUpdateRequest.ts +4 -4
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/ProviderEnum.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/TokenRefresh.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/TokenRefreshRequest.ts +2 -2
- package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/User.ts +13 -13
- package/src/_api/generated/_cfg_accounts/sdk.gen.ts +5 -0
- package/src/_api/generated/_cfg_accounts/types.gen.ts +5 -0
- package/src/_api/generated/{cfg_totp → _cfg_centrifugo}/api.ts +11 -72
- package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/events.ts +3 -3
- package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/hooks/index.ts +1 -1
- package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/hooks/useCfgCentrifugoAuthTokenRetrieve.ts +5 -6
- package/src/_api/generated/{cfg_accounts → _cfg_centrifugo}/index.ts +3 -3
- package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/schemas/ConnectionTokenResponse.ts +4 -4
- package/src/_api/generated/_cfg_centrifugo/sdk.gen.ts +5 -0
- package/src/_api/generated/_cfg_centrifugo/types.gen.ts +5 -0
- package/src/_api/generated/{cfg_accounts → _cfg_totp}/api.ts +11 -78
- package/src/_api/generated/{cfg_accounts → _cfg_totp}/events.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/index.ts +1 -1
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpBackupCodesRegenerateCreate.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpBackupCodesRetrieve.ts +5 -6
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpDevicesDestroy.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpDevicesRetrieve.ts +5 -6
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpDisableCreate.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpSetupConfirmCreate.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpSetupCreate.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpVerifyBackupCreate.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpVerifyCreate.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/index.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/BackupCodesRegenerateRequest.ts +2 -2
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/BackupCodesRegenerateResponse.ts +2 -2
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/BackupCodesStatus.ts +2 -2
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/ConfirmSetupRequest.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/ConfirmSetupResponse.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DeviceList.ts +6 -6
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DeviceListResponse.ts +2 -2
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DeviceListStatusEnum.ts +2 -2
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DisableRequest.ts +2 -2
- package/src/_api/generated/_cfg_totp/schemas/SetupRequest.ts +11 -0
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/SetupResponse.ts +4 -4
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/TotpVerifyUser.ts +12 -12
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/VerifyBackupRequest.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/VerifyRequest.ts +3 -3
- package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/VerifyResponse.ts +4 -4
- package/src/_api/generated/_cfg_totp/sdk.gen.ts +5 -0
- package/src/_api/generated/_cfg_totp/types.gen.ts +5 -0
- package/src/_api/generated/index.ts +11 -13
- package/src/_api/generated/{cfg_accounts/sdk.gen.ts → sdk.gen.ts} +455 -1
- package/src/_api/generated/{cfg_accounts/types.gen.ts → types.gen.ts} +607 -77
- package/src/auth/context/AccountsContext.tsx +10 -10
- package/src/auth/context/AuthContext.tsx +1 -1
- package/src/auth/hooks/useDeleteAccount.ts +2 -1
- package/src/auth/hooks/useGithubAuth.ts +3 -2
- package/src/auth/hooks/useTokenRefresh.ts +2 -1
- package/src/auth/hooks/useTwoFactor.ts +4 -3
- package/src/auth/hooks/useTwoFactorSetup.ts +3 -2
- package/src/auth/hooks/useTwoFactorStatus.ts +4 -3
- package/src/auth/middlewares/tokenRefresh.ts +2 -1
- package/src/clients.ts +3 -3
- package/src/index.ts +22 -5
- package/src/server.ts +9 -9
- package/src/_api/generated/cfg_centrifugo/client/client.gen.ts +0 -280
- package/src/_api/generated/cfg_centrifugo/client/index.ts +0 -25
- package/src/_api/generated/cfg_centrifugo/client/types.gen.ts +0 -217
- package/src/_api/generated/cfg_centrifugo/client/utils.gen.ts +0 -318
- package/src/_api/generated/cfg_centrifugo/client.gen.ts +0 -16
- package/src/_api/generated/cfg_centrifugo/core/auth.gen.ts +0 -41
- package/src/_api/generated/cfg_centrifugo/core/bodySerializer.gen.ts +0 -82
- package/src/_api/generated/cfg_centrifugo/core/params.gen.ts +0 -169
- package/src/_api/generated/cfg_centrifugo/core/pathSerializer.gen.ts +0 -171
- package/src/_api/generated/cfg_centrifugo/core/queryKeySerializer.gen.ts +0 -117
- package/src/_api/generated/cfg_centrifugo/core/serverSentEvents.gen.ts +0 -242
- package/src/_api/generated/cfg_centrifugo/core/types.gen.ts +0 -104
- package/src/_api/generated/cfg_centrifugo/core/utils.gen.ts +0 -140
- package/src/_api/generated/cfg_centrifugo/sdk.gen.ts +0 -64
- package/src/_api/generated/cfg_centrifugo/types.gen.ts +0 -61
- package/src/_api/generated/cfg_totp/client/client.gen.ts +0 -280
- package/src/_api/generated/cfg_totp/client/index.ts +0 -25
- package/src/_api/generated/cfg_totp/client/types.gen.ts +0 -217
- package/src/_api/generated/cfg_totp/client/utils.gen.ts +0 -318
- package/src/_api/generated/cfg_totp/client.gen.ts +0 -16
- package/src/_api/generated/cfg_totp/core/auth.gen.ts +0 -41
- package/src/_api/generated/cfg_totp/core/bodySerializer.gen.ts +0 -82
- package/src/_api/generated/cfg_totp/core/params.gen.ts +0 -169
- package/src/_api/generated/cfg_totp/core/pathSerializer.gen.ts +0 -171
- package/src/_api/generated/cfg_totp/core/queryKeySerializer.gen.ts +0 -117
- package/src/_api/generated/cfg_totp/core/serverSentEvents.gen.ts +0 -242
- package/src/_api/generated/cfg_totp/core/types.gen.ts +0 -104
- package/src/_api/generated/cfg_totp/core/utils.gen.ts +0 -140
- package/src/_api/generated/cfg_totp/schemas/SetupRequest.ts +0 -11
- package/src/_api/generated/cfg_totp/sdk.gen.ts +0 -432
- package/src/_api/generated/cfg_totp/types.gen.ts +0 -479
- /package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/index.ts +0 -0
- /package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/schemas/index.ts +0 -0
- /package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/index.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/client → client}/client.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/client → client}/index.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/client → client}/types.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/client → client}/utils.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/client.gen.ts → client.gen.ts} +0 -0
- /package/src/_api/generated/{cfg_accounts/core → core}/auth.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/core → core}/bodySerializer.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/core → core}/params.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/core → core}/pathSerializer.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/core → core}/queryKeySerializer.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/core → core}/serverSentEvents.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/core → core}/types.gen.ts +0 -0
- /package/src/_api/generated/{cfg_accounts/core → core}/utils.gen.ts +0 -0
- /package/src/_api/generated/{_shared → helpers}/errors.ts +0 -0
- /package/src/_api/generated/{_shared → helpers}/index.ts +0 -0
- /package/src/_api/generated/{_shared → helpers}/logger.ts +0 -0
- /package/src/_api/generated/{_shared → helpers}/storage.ts +0 -0
- /package/src/_api/generated/{_shared → helpers}/validation-events.ts +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
|
-
// src/_api/generated/
|
|
4
|
+
// src/_api/generated/core/bodySerializer.gen.ts
|
|
5
5
|
var serializeFormDataPair = /* @__PURE__ */ __name((data, key, value) => {
|
|
6
6
|
if (typeof value === "string" || value instanceof Blob) {
|
|
7
7
|
data.append(key, value);
|
|
@@ -31,7 +31,7 @@ var jsonBodySerializer = {
|
|
|
31
31
|
bodySerializer: /* @__PURE__ */ __name((body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value), "bodySerializer")
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
// src/_api/generated/
|
|
34
|
+
// src/_api/generated/core/params.gen.ts
|
|
35
35
|
var extraPrefixesMap = {
|
|
36
36
|
$body_: "body",
|
|
37
37
|
$headers_: "headers",
|
|
@@ -40,7 +40,7 @@ var extraPrefixesMap = {
|
|
|
40
40
|
};
|
|
41
41
|
var extraPrefixes = Object.entries(extraPrefixesMap);
|
|
42
42
|
|
|
43
|
-
// src/_api/generated/
|
|
43
|
+
// src/_api/generated/core/serverSentEvents.gen.ts
|
|
44
44
|
function createSseClient({
|
|
45
45
|
onRequest,
|
|
46
46
|
onSseError,
|
|
@@ -168,7 +168,7 @@ function createSseClient({
|
|
|
168
168
|
}
|
|
169
169
|
__name(createSseClient, "createSseClient");
|
|
170
170
|
|
|
171
|
-
// src/_api/generated/
|
|
171
|
+
// src/_api/generated/core/pathSerializer.gen.ts
|
|
172
172
|
var separatorArrayExplode = /* @__PURE__ */ __name((style) => {
|
|
173
173
|
switch (style) {
|
|
174
174
|
case "label":
|
|
@@ -292,7 +292,7 @@ var serializeObjectParam = /* @__PURE__ */ __name(({
|
|
|
292
292
|
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
293
293
|
}, "serializeObjectParam");
|
|
294
294
|
|
|
295
|
-
// src/_api/generated/
|
|
295
|
+
// src/_api/generated/core/utils.gen.ts
|
|
296
296
|
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
297
297
|
var defaultPathSerializer = /* @__PURE__ */ __name(({ path, url: _url }) => {
|
|
298
298
|
let url = _url;
|
|
@@ -390,7 +390,7 @@ function getValidRequestBody(options) {
|
|
|
390
390
|
}
|
|
391
391
|
__name(getValidRequestBody, "getValidRequestBody");
|
|
392
392
|
|
|
393
|
-
// src/_api/generated/
|
|
393
|
+
// src/_api/generated/core/auth.gen.ts
|
|
394
394
|
var getAuthToken = /* @__PURE__ */ __name(async (auth, callback) => {
|
|
395
395
|
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
396
396
|
if (!token) {
|
|
@@ -405,7 +405,7 @@ var getAuthToken = /* @__PURE__ */ __name(async (auth, callback) => {
|
|
|
405
405
|
return token;
|
|
406
406
|
}, "getAuthToken");
|
|
407
407
|
|
|
408
|
-
// src/_api/generated/
|
|
408
|
+
// src/_api/generated/client/utils.gen.ts
|
|
409
409
|
var createQuerySerializer = /* @__PURE__ */ __name(({
|
|
410
410
|
parameters = {},
|
|
411
411
|
...args
|
|
@@ -624,7 +624,7 @@ var createConfig = /* @__PURE__ */ __name((override = {}) => ({
|
|
|
624
624
|
...override
|
|
625
625
|
}), "createConfig");
|
|
626
626
|
|
|
627
|
-
// src/_api/generated/
|
|
627
|
+
// src/_api/generated/client/client.gen.ts
|
|
628
628
|
var createClient = /* @__PURE__ */ __name((config = {}) => {
|
|
629
629
|
let _config = mergeConfigs(createConfig(), config);
|
|
630
630
|
const getConfig = /* @__PURE__ */ __name(() => ({ ..._config }), "getConfig");
|
|
@@ -822,10 +822,10 @@ var createClient = /* @__PURE__ */ __name((config = {}) => {
|
|
|
822
822
|
};
|
|
823
823
|
}, "createClient");
|
|
824
824
|
|
|
825
|
-
// src/_api/generated/
|
|
825
|
+
// src/_api/generated/client.gen.ts
|
|
826
826
|
var client = createClient(createConfig({ baseUrl: "http://localhost:8000" }));
|
|
827
827
|
|
|
828
|
-
// src/_api/generated/
|
|
828
|
+
// src/_api/generated/helpers/storage.ts
|
|
829
829
|
var LocalStorageAdapter = class {
|
|
830
830
|
static {
|
|
831
831
|
__name(this, "LocalStorageAdapter");
|
|
@@ -915,7 +915,7 @@ var CookieStorageAdapter = class {
|
|
|
915
915
|
}
|
|
916
916
|
};
|
|
917
917
|
|
|
918
|
-
// src/_api/generated/
|
|
918
|
+
// src/_api/generated/helpers/logger.ts
|
|
919
919
|
import { createConsola } from "consola";
|
|
920
920
|
var DEFAULT_CONFIG = {
|
|
921
921
|
enabled: typeof process !== "undefined" && process.env.NODE_ENV !== "production",
|
|
@@ -1009,482 +1009,426 @@ var APILogger = class {
|
|
|
1009
1009
|
};
|
|
1010
1010
|
var defaultLogger = new APILogger();
|
|
1011
1011
|
|
|
1012
|
-
// src/_api/generated/
|
|
1013
|
-
var
|
|
1012
|
+
// src/_api/generated/_cfg_accounts/api.ts
|
|
1013
|
+
var ACCESS_KEY = "cfg.access_token";
|
|
1014
|
+
var REFRESH_KEY = "cfg.refresh_token";
|
|
1015
|
+
function detectLocale() {
|
|
1016
|
+
try {
|
|
1017
|
+
if (typeof document !== "undefined") {
|
|
1018
|
+
const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
1019
|
+
if (m) return decodeURIComponent(m[1]);
|
|
1020
|
+
}
|
|
1021
|
+
if (typeof navigator !== "undefined" && navigator.language) {
|
|
1022
|
+
return navigator.language;
|
|
1023
|
+
}
|
|
1024
|
+
} catch {
|
|
1025
|
+
}
|
|
1026
|
+
return null;
|
|
1027
|
+
}
|
|
1028
|
+
__name(detectLocale, "detectLocale");
|
|
1029
|
+
var API = class {
|
|
1014
1030
|
static {
|
|
1015
|
-
__name(this, "
|
|
1031
|
+
__name(this, "API");
|
|
1016
1032
|
}
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1033
|
+
baseUrl;
|
|
1034
|
+
storage;
|
|
1035
|
+
locale;
|
|
1036
|
+
apiKey;
|
|
1037
|
+
logger;
|
|
1038
|
+
constructor(baseUrl2, opts = {}) {
|
|
1039
|
+
this.baseUrl = baseUrl2.replace(/\/$/, "");
|
|
1040
|
+
this.storage = opts.storage ?? new LocalStorageAdapter();
|
|
1041
|
+
this.logger = new APILogger(opts.logger);
|
|
1042
|
+
this.locale = opts.locale ?? null;
|
|
1043
|
+
this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
|
|
1044
|
+
const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
|
|
1045
|
+
client.setConfig({ baseUrl: this.baseUrl, credentials });
|
|
1046
|
+
client.interceptors.request.use((request) => {
|
|
1047
|
+
const access = this.getToken();
|
|
1048
|
+
if (access) request.headers.set("Authorization", `Bearer ${access}`);
|
|
1049
|
+
const locale = this.locale ?? detectLocale();
|
|
1050
|
+
if (locale) request.headers.set("Accept-Language", locale);
|
|
1051
|
+
if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
|
|
1052
|
+
return request;
|
|
1027
1053
|
});
|
|
1028
1054
|
}
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
* Remove OAuth connection for the specified provider.
|
|
1033
|
-
*/
|
|
1034
|
-
static cfgAccountsOauthDisconnectCreate(options) {
|
|
1035
|
-
return (options.client ?? client).post({
|
|
1036
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1037
|
-
url: "/cfg/accounts/oauth/disconnect/",
|
|
1038
|
-
...options,
|
|
1039
|
-
headers: {
|
|
1040
|
-
"Content-Type": "application/json",
|
|
1041
|
-
...options.headers
|
|
1042
|
-
}
|
|
1043
|
-
});
|
|
1055
|
+
// ── Base URL ────────────────────────────────────────────────────────────
|
|
1056
|
+
getBaseUrl() {
|
|
1057
|
+
return this.baseUrl;
|
|
1044
1058
|
}
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
* Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
|
|
1049
|
-
*/
|
|
1050
|
-
static cfgAccountsOauthGithubAuthorizeCreate(options) {
|
|
1051
|
-
return (options?.client ?? client).post({
|
|
1052
|
-
url: "/cfg/accounts/oauth/github/authorize/",
|
|
1053
|
-
...options,
|
|
1054
|
-
headers: {
|
|
1055
|
-
"Content-Type": "application/json",
|
|
1056
|
-
...options?.headers
|
|
1057
|
-
}
|
|
1058
|
-
});
|
|
1059
|
+
setBaseUrl(url) {
|
|
1060
|
+
this.baseUrl = url.replace(/\/$/, "");
|
|
1061
|
+
client.setConfig({ baseUrl: this.baseUrl });
|
|
1059
1062
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
* Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
|
|
1064
|
-
*/
|
|
1065
|
-
static cfgAccountsOauthGithubCallbackCreate(options) {
|
|
1066
|
-
return (options.client ?? client).post({
|
|
1067
|
-
url: "/cfg/accounts/oauth/github/callback/",
|
|
1068
|
-
...options,
|
|
1069
|
-
headers: {
|
|
1070
|
-
"Content-Type": "application/json",
|
|
1071
|
-
...options.headers
|
|
1072
|
-
}
|
|
1073
|
-
});
|
|
1063
|
+
// ── Tokens ──────────────────────────────────────────────────────────────
|
|
1064
|
+
getToken() {
|
|
1065
|
+
return this.storage.getItem(ACCESS_KEY);
|
|
1074
1066
|
}
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
* Get list of available OAuth providers for authentication.
|
|
1079
|
-
*/
|
|
1080
|
-
static cfgAccountsOauthProvidersRetrieve(options) {
|
|
1081
|
-
return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
|
|
1067
|
+
setToken(token) {
|
|
1068
|
+
if (token) this.storage.setItem(ACCESS_KEY, token);
|
|
1069
|
+
else this.storage.removeItem(ACCESS_KEY);
|
|
1082
1070
|
}
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
*/
|
|
1086
|
-
static cfgAccountsOtpRequestCreate(options) {
|
|
1087
|
-
return (options.client ?? client).post({
|
|
1088
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1089
|
-
url: "/cfg/accounts/otp/request/",
|
|
1090
|
-
...options,
|
|
1091
|
-
headers: {
|
|
1092
|
-
"Content-Type": "application/json",
|
|
1093
|
-
...options.headers
|
|
1094
|
-
}
|
|
1095
|
-
});
|
|
1071
|
+
getRefreshToken() {
|
|
1072
|
+
return this.storage.getItem(REFRESH_KEY);
|
|
1096
1073
|
}
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
* If user has 2FA enabled:
|
|
1101
|
-
* - Returns requires_2fa=True with session_id
|
|
1102
|
-
* - Client must complete 2FA verification at /cfg/totp/verify/
|
|
1103
|
-
*
|
|
1104
|
-
* If user has no 2FA:
|
|
1105
|
-
* - Returns JWT tokens and user data directly
|
|
1106
|
-
*/
|
|
1107
|
-
static cfgAccountsOtpVerifyCreate(options) {
|
|
1108
|
-
return (options.client ?? client).post({
|
|
1109
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1110
|
-
url: "/cfg/accounts/otp/verify/",
|
|
1111
|
-
...options,
|
|
1112
|
-
headers: {
|
|
1113
|
-
"Content-Type": "application/json",
|
|
1114
|
-
...options.headers
|
|
1115
|
-
}
|
|
1116
|
-
});
|
|
1074
|
+
setRefreshToken(token) {
|
|
1075
|
+
if (token) this.storage.setItem(REFRESH_KEY, token);
|
|
1076
|
+
else this.storage.removeItem(REFRESH_KEY);
|
|
1117
1077
|
}
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
* Retrieve the current authenticated user's profile information.
|
|
1122
|
-
*/
|
|
1123
|
-
static cfgAccountsProfileRetrieve(options) {
|
|
1124
|
-
return (options?.client ?? client).get({
|
|
1125
|
-
security: [{ scheme: "bearer", type: "http" }, {
|
|
1126
|
-
in: "cookie",
|
|
1127
|
-
name: "sessionid",
|
|
1128
|
-
type: "apiKey"
|
|
1129
|
-
}],
|
|
1130
|
-
url: "/cfg/accounts/profile/",
|
|
1131
|
-
...options
|
|
1132
|
-
});
|
|
1078
|
+
clearToken() {
|
|
1079
|
+
this.storage.removeItem(ACCESS_KEY);
|
|
1080
|
+
this.storage.removeItem(REFRESH_KEY);
|
|
1133
1081
|
}
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
*
|
|
1137
|
-
* Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
|
|
1138
|
-
*/
|
|
1139
|
-
static cfgAccountsProfileAvatarCreate(options) {
|
|
1140
|
-
return (options?.client ?? client).post({
|
|
1141
|
-
...formDataBodySerializer,
|
|
1142
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1143
|
-
url: "/cfg/accounts/profile/avatar/",
|
|
1144
|
-
...options,
|
|
1145
|
-
headers: {
|
|
1146
|
-
"Content-Type": null,
|
|
1147
|
-
...options?.headers
|
|
1148
|
-
}
|
|
1149
|
-
});
|
|
1082
|
+
isAuthenticated() {
|
|
1083
|
+
return this.getToken() !== null;
|
|
1150
1084
|
}
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
*
|
|
1155
|
-
* Permanently delete the current user's account.
|
|
1156
|
-
*
|
|
1157
|
-
* This operation:
|
|
1158
|
-
* - Deactivates the account (user cannot log in)
|
|
1159
|
-
* - Anonymizes personal data (GDPR compliance)
|
|
1160
|
-
* - Frees up the email address for re-registration
|
|
1161
|
-
* - Preserves audit trail
|
|
1162
|
-
*
|
|
1163
|
-
* The account can be restored by an administrator if needed.
|
|
1164
|
-
*
|
|
1165
|
-
*/
|
|
1166
|
-
static cfgAccountsProfileDeleteCreate(options) {
|
|
1167
|
-
return (options?.client ?? client).post({
|
|
1168
|
-
security: [{ scheme: "bearer", type: "http" }, {
|
|
1169
|
-
in: "cookie",
|
|
1170
|
-
name: "sessionid",
|
|
1171
|
-
type: "apiKey"
|
|
1172
|
-
}],
|
|
1173
|
-
url: "/cfg/accounts/profile/delete/",
|
|
1174
|
-
...options
|
|
1175
|
-
});
|
|
1085
|
+
// ── Locale / API key ────────────────────────────────────────────────────
|
|
1086
|
+
getLocale() {
|
|
1087
|
+
return this.locale ?? detectLocale();
|
|
1176
1088
|
}
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
*
|
|
1180
|
-
* Partially update the current authenticated user's profile information. Supports avatar upload.
|
|
1181
|
-
*/
|
|
1182
|
-
static cfgAccountsProfilePartialPartialUpdate(options) {
|
|
1183
|
-
return (options?.client ?? client).patch({
|
|
1184
|
-
security: [{ scheme: "bearer", type: "http" }, {
|
|
1185
|
-
in: "cookie",
|
|
1186
|
-
name: "sessionid",
|
|
1187
|
-
type: "apiKey"
|
|
1188
|
-
}],
|
|
1189
|
-
url: "/cfg/accounts/profile/partial/",
|
|
1190
|
-
...options,
|
|
1191
|
-
headers: {
|
|
1192
|
-
"Content-Type": "application/json",
|
|
1193
|
-
...options?.headers
|
|
1194
|
-
}
|
|
1195
|
-
});
|
|
1089
|
+
setLocale(locale) {
|
|
1090
|
+
this.locale = locale;
|
|
1196
1091
|
}
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
*
|
|
1200
|
-
* Partially update the current authenticated user's profile information. Supports avatar upload.
|
|
1201
|
-
*/
|
|
1202
|
-
static cfgAccountsProfilePartialUpdate(options) {
|
|
1203
|
-
return (options?.client ?? client).put({
|
|
1204
|
-
security: [{ scheme: "bearer", type: "http" }, {
|
|
1205
|
-
in: "cookie",
|
|
1206
|
-
name: "sessionid",
|
|
1207
|
-
type: "apiKey"
|
|
1208
|
-
}],
|
|
1209
|
-
url: "/cfg/accounts/profile/partial/",
|
|
1210
|
-
...options,
|
|
1211
|
-
headers: {
|
|
1212
|
-
"Content-Type": "application/json",
|
|
1213
|
-
...options?.headers
|
|
1214
|
-
}
|
|
1215
|
-
});
|
|
1092
|
+
getApiKey() {
|
|
1093
|
+
return this.apiKey;
|
|
1216
1094
|
}
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
*
|
|
1220
|
-
* Update the current authenticated user's profile information.
|
|
1221
|
-
*/
|
|
1222
|
-
static cfgAccountsProfileUpdatePartialUpdate(options) {
|
|
1223
|
-
return (options?.client ?? client).patch({
|
|
1224
|
-
security: [{ scheme: "bearer", type: "http" }, {
|
|
1225
|
-
in: "cookie",
|
|
1226
|
-
name: "sessionid",
|
|
1227
|
-
type: "apiKey"
|
|
1228
|
-
}],
|
|
1229
|
-
url: "/cfg/accounts/profile/update/",
|
|
1230
|
-
...options,
|
|
1231
|
-
headers: {
|
|
1232
|
-
"Content-Type": "application/json",
|
|
1233
|
-
...options?.headers
|
|
1234
|
-
}
|
|
1235
|
-
});
|
|
1236
|
-
}
|
|
1237
|
-
/**
|
|
1238
|
-
* Update user profile
|
|
1239
|
-
*
|
|
1240
|
-
* Update the current authenticated user's profile information.
|
|
1241
|
-
*/
|
|
1242
|
-
static cfgAccountsProfileUpdateUpdate(options) {
|
|
1243
|
-
return (options?.client ?? client).put({
|
|
1244
|
-
security: [{ scheme: "bearer", type: "http" }, {
|
|
1245
|
-
in: "cookie",
|
|
1246
|
-
name: "sessionid",
|
|
1247
|
-
type: "apiKey"
|
|
1248
|
-
}],
|
|
1249
|
-
url: "/cfg/accounts/profile/update/",
|
|
1250
|
-
...options,
|
|
1251
|
-
headers: {
|
|
1252
|
-
"Content-Type": "application/json",
|
|
1253
|
-
...options?.headers
|
|
1254
|
-
}
|
|
1255
|
-
});
|
|
1256
|
-
}
|
|
1257
|
-
/**
|
|
1258
|
-
* Refresh JWT token.
|
|
1259
|
-
*/
|
|
1260
|
-
static cfgAccountsTokenRefreshCreate(options) {
|
|
1261
|
-
return (options.client ?? client).post({
|
|
1262
|
-
url: "/cfg/accounts/token/refresh/",
|
|
1263
|
-
...options,
|
|
1264
|
-
headers: {
|
|
1265
|
-
"Content-Type": "application/json",
|
|
1266
|
-
...options.headers
|
|
1267
|
-
}
|
|
1268
|
-
});
|
|
1095
|
+
setApiKey(key) {
|
|
1096
|
+
this.apiKey = key;
|
|
1269
1097
|
}
|
|
1270
1098
|
};
|
|
1271
|
-
|
|
1099
|
+
|
|
1100
|
+
// src/_api/generated/helpers/errors.ts
|
|
1101
|
+
var APIError = class extends Error {
|
|
1102
|
+
constructor(statusCode, statusText, response, url, message) {
|
|
1103
|
+
super(message || `HTTP ${statusCode}: ${statusText}`);
|
|
1104
|
+
this.statusCode = statusCode;
|
|
1105
|
+
this.statusText = statusText;
|
|
1106
|
+
this.response = response;
|
|
1107
|
+
this.url = url;
|
|
1108
|
+
this.name = "APIError";
|
|
1109
|
+
}
|
|
1272
1110
|
static {
|
|
1273
|
-
__name(this, "
|
|
1111
|
+
__name(this, "APIError");
|
|
1274
1112
|
}
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
static cfgAccountsOauthConnectionsList(options) {
|
|
1281
|
-
return (options?.client ?? client).get({
|
|
1282
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1283
|
-
url: "/cfg/accounts/oauth/connections/",
|
|
1284
|
-
...options
|
|
1285
|
-
});
|
|
1113
|
+
get details() {
|
|
1114
|
+
if (typeof this.response === "object" && this.response !== null) {
|
|
1115
|
+
return this.response;
|
|
1116
|
+
}
|
|
1117
|
+
return null;
|
|
1286
1118
|
}
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
url: "/cfg/accounts/oauth/disconnect/",
|
|
1296
|
-
...options,
|
|
1297
|
-
headers: {
|
|
1298
|
-
"Content-Type": "application/json",
|
|
1299
|
-
...options.headers
|
|
1300
|
-
}
|
|
1301
|
-
});
|
|
1119
|
+
get fieldErrors() {
|
|
1120
|
+
const details = this.details;
|
|
1121
|
+
if (!details) return null;
|
|
1122
|
+
const fieldErrors = {};
|
|
1123
|
+
for (const [key, value] of Object.entries(details)) {
|
|
1124
|
+
if (Array.isArray(value)) fieldErrors[key] = value;
|
|
1125
|
+
}
|
|
1126
|
+
return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
|
|
1302
1127
|
}
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1128
|
+
get errorMessage() {
|
|
1129
|
+
const details = this.details;
|
|
1130
|
+
if (!details) return this.message;
|
|
1131
|
+
if (details.detail) {
|
|
1132
|
+
return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
|
|
1133
|
+
}
|
|
1134
|
+
if (details.error) return String(details.error);
|
|
1135
|
+
if (details.message) return String(details.message);
|
|
1136
|
+
const fieldErrors = this.fieldErrors;
|
|
1137
|
+
if (fieldErrors) {
|
|
1138
|
+
const firstField = Object.keys(fieldErrors)[0];
|
|
1139
|
+
if (firstField) return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
|
|
1140
|
+
}
|
|
1141
|
+
return this.message;
|
|
1317
1142
|
}
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
*
|
|
1321
|
-
* Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
|
|
1322
|
-
*/
|
|
1323
|
-
static cfgAccountsOauthGithubCallbackCreate(options) {
|
|
1324
|
-
return (options.client ?? client).post({
|
|
1325
|
-
url: "/cfg/accounts/oauth/github/callback/",
|
|
1326
|
-
...options,
|
|
1327
|
-
headers: {
|
|
1328
|
-
"Content-Type": "application/json",
|
|
1329
|
-
...options.headers
|
|
1330
|
-
}
|
|
1331
|
-
});
|
|
1143
|
+
get isValidationError() {
|
|
1144
|
+
return this.statusCode === 400;
|
|
1332
1145
|
}
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
*
|
|
1336
|
-
* Get list of available OAuth providers for authentication.
|
|
1337
|
-
*/
|
|
1338
|
-
static cfgAccountsOauthProvidersRetrieve(options) {
|
|
1339
|
-
return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
|
|
1146
|
+
get isAuthError() {
|
|
1147
|
+
return this.statusCode === 401;
|
|
1340
1148
|
}
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
*/
|
|
1344
|
-
static cfgAccountsOtpRequestCreate(options) {
|
|
1345
|
-
return (options.client ?? client).post({
|
|
1346
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1347
|
-
url: "/cfg/accounts/otp/request/",
|
|
1348
|
-
...options,
|
|
1349
|
-
headers: {
|
|
1350
|
-
"Content-Type": "application/json",
|
|
1351
|
-
...options.headers
|
|
1352
|
-
}
|
|
1353
|
-
});
|
|
1149
|
+
get isPermissionError() {
|
|
1150
|
+
return this.statusCode === 403;
|
|
1354
1151
|
}
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
*
|
|
1358
|
-
* If user has 2FA enabled:
|
|
1359
|
-
* - Returns requires_2fa=True with session_id
|
|
1360
|
-
* - Client must complete 2FA verification at /cfg/totp/verify/
|
|
1361
|
-
*
|
|
1362
|
-
* If user has no 2FA:
|
|
1363
|
-
* - Returns JWT tokens and user data directly
|
|
1364
|
-
*/
|
|
1365
|
-
static cfgAccountsOtpVerifyCreate(options) {
|
|
1366
|
-
return (options.client ?? client).post({
|
|
1367
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1368
|
-
url: "/cfg/accounts/otp/verify/",
|
|
1369
|
-
...options,
|
|
1370
|
-
headers: {
|
|
1371
|
-
"Content-Type": "application/json",
|
|
1372
|
-
...options.headers
|
|
1373
|
-
}
|
|
1374
|
-
});
|
|
1152
|
+
get isNotFoundError() {
|
|
1153
|
+
return this.statusCode === 404;
|
|
1375
1154
|
}
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
*
|
|
1379
|
-
* Retrieve the current authenticated user's profile information.
|
|
1380
|
-
*/
|
|
1381
|
-
static cfgAccountsProfileRetrieve(options) {
|
|
1382
|
-
return (options?.client ?? client).get({
|
|
1383
|
-
security: [{ scheme: "bearer", type: "http" }, {
|
|
1384
|
-
in: "cookie",
|
|
1385
|
-
name: "sessionid",
|
|
1386
|
-
type: "apiKey"
|
|
1387
|
-
}],
|
|
1388
|
-
url: "/cfg/accounts/profile/",
|
|
1389
|
-
...options
|
|
1390
|
-
});
|
|
1155
|
+
get isServerError() {
|
|
1156
|
+
return this.statusCode >= 500 && this.statusCode < 600;
|
|
1391
1157
|
}
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1158
|
+
};
|
|
1159
|
+
var NetworkError = class extends Error {
|
|
1160
|
+
constructor(message, url, originalError) {
|
|
1161
|
+
super(message);
|
|
1162
|
+
this.url = url;
|
|
1163
|
+
this.originalError = originalError;
|
|
1164
|
+
this.name = "NetworkError";
|
|
1165
|
+
}
|
|
1166
|
+
static {
|
|
1167
|
+
__name(this, "NetworkError");
|
|
1168
|
+
}
|
|
1169
|
+
};
|
|
1170
|
+
|
|
1171
|
+
// src/_api/generated/helpers/validation-events.ts
|
|
1172
|
+
function dispatchValidationError(detail) {
|
|
1173
|
+
if (typeof window === "undefined") return;
|
|
1174
|
+
try {
|
|
1175
|
+
const event = new CustomEvent("zod-validation-error", {
|
|
1176
|
+
detail,
|
|
1177
|
+
bubbles: true,
|
|
1178
|
+
cancelable: false
|
|
1407
1179
|
});
|
|
1180
|
+
window.dispatchEvent(event);
|
|
1181
|
+
} catch (error) {
|
|
1182
|
+
console.warn("Failed to dispatch validation error event:", error);
|
|
1408
1183
|
}
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1184
|
+
}
|
|
1185
|
+
__name(dispatchValidationError, "dispatchValidationError");
|
|
1186
|
+
function onValidationError(callback) {
|
|
1187
|
+
if (typeof window === "undefined") return () => {
|
|
1188
|
+
};
|
|
1189
|
+
const handler = /* @__PURE__ */ __name((event) => {
|
|
1190
|
+
if (event instanceof CustomEvent) callback(event.detail);
|
|
1191
|
+
}, "handler");
|
|
1192
|
+
window.addEventListener("zod-validation-error", handler);
|
|
1193
|
+
return () => window.removeEventListener("zod-validation-error", handler);
|
|
1194
|
+
}
|
|
1195
|
+
__name(onValidationError, "onValidationError");
|
|
1196
|
+
function formatZodError(error) {
|
|
1197
|
+
const issues = error.issues.map((issue, index) => {
|
|
1198
|
+
const path = issue.path.join(".") || "root";
|
|
1199
|
+
const parts = [`${index + 1}. ${path}: ${issue.message}`];
|
|
1200
|
+
if ("expected" in issue && issue.expected) parts.push(` Expected: ${issue.expected}`);
|
|
1201
|
+
if ("received" in issue && issue.received) parts.push(` Received: ${issue.received}`);
|
|
1202
|
+
return parts.join("\n");
|
|
1203
|
+
});
|
|
1204
|
+
return issues.join("\n");
|
|
1205
|
+
}
|
|
1206
|
+
__name(formatZodError, "formatZodError");
|
|
1207
|
+
|
|
1208
|
+
// src/_api/generated/_cfg_centrifugo/api.ts
|
|
1209
|
+
var ACCESS_KEY2 = "cfg.access_token";
|
|
1210
|
+
var REFRESH_KEY2 = "cfg.refresh_token";
|
|
1211
|
+
function detectLocale2() {
|
|
1212
|
+
try {
|
|
1213
|
+
if (typeof document !== "undefined") {
|
|
1214
|
+
const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
1215
|
+
if (m) return decodeURIComponent(m[1]);
|
|
1216
|
+
}
|
|
1217
|
+
if (typeof navigator !== "undefined" && navigator.language) {
|
|
1218
|
+
return navigator.language;
|
|
1219
|
+
}
|
|
1220
|
+
} catch {
|
|
1221
|
+
}
|
|
1222
|
+
return null;
|
|
1223
|
+
}
|
|
1224
|
+
__name(detectLocale2, "detectLocale");
|
|
1225
|
+
var API2 = class {
|
|
1226
|
+
static {
|
|
1227
|
+
__name(this, "API");
|
|
1228
|
+
}
|
|
1229
|
+
baseUrl;
|
|
1230
|
+
storage;
|
|
1231
|
+
locale;
|
|
1232
|
+
apiKey;
|
|
1233
|
+
logger;
|
|
1234
|
+
constructor(baseUrl2, opts = {}) {
|
|
1235
|
+
this.baseUrl = baseUrl2.replace(/\/$/, "");
|
|
1236
|
+
this.storage = opts.storage ?? new LocalStorageAdapter();
|
|
1237
|
+
this.logger = new APILogger(opts.logger);
|
|
1238
|
+
this.locale = opts.locale ?? null;
|
|
1239
|
+
this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
|
|
1240
|
+
const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
|
|
1241
|
+
client.setConfig({ baseUrl: this.baseUrl, credentials });
|
|
1242
|
+
client.interceptors.request.use((request) => {
|
|
1243
|
+
const access = this.getToken();
|
|
1244
|
+
if (access) request.headers.set("Authorization", `Bearer ${access}`);
|
|
1245
|
+
const locale = this.locale ?? detectLocale2();
|
|
1246
|
+
if (locale) request.headers.set("Accept-Language", locale);
|
|
1247
|
+
if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
|
|
1248
|
+
return request;
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
// ── Base URL ────────────────────────────────────────────────────────────
|
|
1252
|
+
getBaseUrl() {
|
|
1253
|
+
return this.baseUrl;
|
|
1254
|
+
}
|
|
1255
|
+
setBaseUrl(url) {
|
|
1256
|
+
this.baseUrl = url.replace(/\/$/, "");
|
|
1257
|
+
client.setConfig({ baseUrl: this.baseUrl });
|
|
1258
|
+
}
|
|
1259
|
+
// ── Tokens ──────────────────────────────────────────────────────────────
|
|
1260
|
+
getToken() {
|
|
1261
|
+
return this.storage.getItem(ACCESS_KEY2);
|
|
1262
|
+
}
|
|
1263
|
+
setToken(token) {
|
|
1264
|
+
if (token) this.storage.setItem(ACCESS_KEY2, token);
|
|
1265
|
+
else this.storage.removeItem(ACCESS_KEY2);
|
|
1266
|
+
}
|
|
1267
|
+
getRefreshToken() {
|
|
1268
|
+
return this.storage.getItem(REFRESH_KEY2);
|
|
1269
|
+
}
|
|
1270
|
+
setRefreshToken(token) {
|
|
1271
|
+
if (token) this.storage.setItem(REFRESH_KEY2, token);
|
|
1272
|
+
else this.storage.removeItem(REFRESH_KEY2);
|
|
1273
|
+
}
|
|
1274
|
+
clearToken() {
|
|
1275
|
+
this.storage.removeItem(ACCESS_KEY2);
|
|
1276
|
+
this.storage.removeItem(REFRESH_KEY2);
|
|
1277
|
+
}
|
|
1278
|
+
isAuthenticated() {
|
|
1279
|
+
return this.getToken() !== null;
|
|
1280
|
+
}
|
|
1281
|
+
// ── Locale / API key ────────────────────────────────────────────────────
|
|
1282
|
+
getLocale() {
|
|
1283
|
+
return this.locale ?? detectLocale2();
|
|
1284
|
+
}
|
|
1285
|
+
setLocale(locale) {
|
|
1286
|
+
this.locale = locale;
|
|
1287
|
+
}
|
|
1288
|
+
getApiKey() {
|
|
1289
|
+
return this.apiKey;
|
|
1290
|
+
}
|
|
1291
|
+
setApiKey(key) {
|
|
1292
|
+
this.apiKey = key;
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
|
|
1296
|
+
// src/_api/generated/_cfg_totp/api.ts
|
|
1297
|
+
var ACCESS_KEY3 = "cfg.access_token";
|
|
1298
|
+
var REFRESH_KEY3 = "cfg.refresh_token";
|
|
1299
|
+
function detectLocale3() {
|
|
1300
|
+
try {
|
|
1301
|
+
if (typeof document !== "undefined") {
|
|
1302
|
+
const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
1303
|
+
if (m) return decodeURIComponent(m[1]);
|
|
1304
|
+
}
|
|
1305
|
+
if (typeof navigator !== "undefined" && navigator.language) {
|
|
1306
|
+
return navigator.language;
|
|
1307
|
+
}
|
|
1308
|
+
} catch {
|
|
1309
|
+
}
|
|
1310
|
+
return null;
|
|
1311
|
+
}
|
|
1312
|
+
__name(detectLocale3, "detectLocale");
|
|
1313
|
+
var API3 = class {
|
|
1314
|
+
static {
|
|
1315
|
+
__name(this, "API");
|
|
1316
|
+
}
|
|
1317
|
+
baseUrl;
|
|
1318
|
+
storage;
|
|
1319
|
+
locale;
|
|
1320
|
+
apiKey;
|
|
1321
|
+
logger;
|
|
1322
|
+
constructor(baseUrl2, opts = {}) {
|
|
1323
|
+
this.baseUrl = baseUrl2.replace(/\/$/, "");
|
|
1324
|
+
this.storage = opts.storage ?? new LocalStorageAdapter();
|
|
1325
|
+
this.logger = new APILogger(opts.logger);
|
|
1326
|
+
this.locale = opts.locale ?? null;
|
|
1327
|
+
this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
|
|
1328
|
+
const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
|
|
1329
|
+
client.setConfig({ baseUrl: this.baseUrl, credentials });
|
|
1330
|
+
client.interceptors.request.use((request) => {
|
|
1331
|
+
const access = this.getToken();
|
|
1332
|
+
if (access) request.headers.set("Authorization", `Bearer ${access}`);
|
|
1333
|
+
const locale = this.locale ?? detectLocale3();
|
|
1334
|
+
if (locale) request.headers.set("Accept-Language", locale);
|
|
1335
|
+
if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
|
|
1336
|
+
return request;
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
// ── Base URL ────────────────────────────────────────────────────────────
|
|
1340
|
+
getBaseUrl() {
|
|
1341
|
+
return this.baseUrl;
|
|
1342
|
+
}
|
|
1343
|
+
setBaseUrl(url) {
|
|
1344
|
+
this.baseUrl = url.replace(/\/$/, "");
|
|
1345
|
+
client.setConfig({ baseUrl: this.baseUrl });
|
|
1346
|
+
}
|
|
1347
|
+
// ── Tokens ──────────────────────────────────────────────────────────────
|
|
1348
|
+
getToken() {
|
|
1349
|
+
return this.storage.getItem(ACCESS_KEY3);
|
|
1350
|
+
}
|
|
1351
|
+
setToken(token) {
|
|
1352
|
+
if (token) this.storage.setItem(ACCESS_KEY3, token);
|
|
1353
|
+
else this.storage.removeItem(ACCESS_KEY3);
|
|
1354
|
+
}
|
|
1355
|
+
getRefreshToken() {
|
|
1356
|
+
return this.storage.getItem(REFRESH_KEY3);
|
|
1357
|
+
}
|
|
1358
|
+
setRefreshToken(token) {
|
|
1359
|
+
if (token) this.storage.setItem(REFRESH_KEY3, token);
|
|
1360
|
+
else this.storage.removeItem(REFRESH_KEY3);
|
|
1361
|
+
}
|
|
1362
|
+
clearToken() {
|
|
1363
|
+
this.storage.removeItem(ACCESS_KEY3);
|
|
1364
|
+
this.storage.removeItem(REFRESH_KEY3);
|
|
1365
|
+
}
|
|
1366
|
+
isAuthenticated() {
|
|
1367
|
+
return this.getToken() !== null;
|
|
1368
|
+
}
|
|
1369
|
+
// ── Locale / API key ────────────────────────────────────────────────────
|
|
1370
|
+
getLocale() {
|
|
1371
|
+
return this.locale ?? detectLocale3();
|
|
1372
|
+
}
|
|
1373
|
+
setLocale(locale) {
|
|
1374
|
+
this.locale = locale;
|
|
1375
|
+
}
|
|
1376
|
+
getApiKey() {
|
|
1377
|
+
return this.apiKey;
|
|
1378
|
+
}
|
|
1379
|
+
setApiKey(key) {
|
|
1380
|
+
this.apiKey = key;
|
|
1381
|
+
}
|
|
1382
|
+
};
|
|
1383
|
+
|
|
1384
|
+
// src/_api/generated/index.ts
|
|
1385
|
+
var isStaticBuild = process.env.NEXT_PUBLIC_STATIC_BUILD === "true";
|
|
1386
|
+
var baseUrl = isStaticBuild ? "" : process.env.NEXT_PUBLIC_API_URL || "";
|
|
1387
|
+
var CfgAccountsApi = new API(baseUrl, { storage: new LocalStorageAdapter() });
|
|
1388
|
+
var CfgCentrifugoApi = new API2(baseUrl, { storage: new LocalStorageAdapter() });
|
|
1389
|
+
var CfgTotpApi = new API3(baseUrl, { storage: new LocalStorageAdapter() });
|
|
1390
|
+
|
|
1391
|
+
// src/_api/generated/sdk.gen.ts
|
|
1392
|
+
var Cfg = class {
|
|
1393
|
+
static {
|
|
1394
|
+
__name(this, "Cfg");
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1397
|
+
* List OAuth connections
|
|
1422
1398
|
*
|
|
1399
|
+
* Get all OAuth connections for the current user.
|
|
1423
1400
|
*/
|
|
1424
|
-
static
|
|
1425
|
-
return (options?.client ?? client).
|
|
1426
|
-
security: [{ scheme: "bearer", type: "http" },
|
|
1427
|
-
|
|
1428
|
-
name: "sessionid",
|
|
1429
|
-
type: "apiKey"
|
|
1430
|
-
}],
|
|
1431
|
-
url: "/cfg/accounts/profile/delete/",
|
|
1401
|
+
static cfgAccountsOauthConnectionsList(options) {
|
|
1402
|
+
return (options?.client ?? client).get({
|
|
1403
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1404
|
+
url: "/cfg/accounts/oauth/connections/",
|
|
1432
1405
|
...options
|
|
1433
1406
|
});
|
|
1434
1407
|
}
|
|
1435
1408
|
/**
|
|
1436
|
-
*
|
|
1409
|
+
* Disconnect OAuth provider
|
|
1437
1410
|
*
|
|
1438
|
-
*
|
|
1411
|
+
* Remove OAuth connection for the specified provider.
|
|
1439
1412
|
*/
|
|
1440
|
-
static
|
|
1441
|
-
return (options
|
|
1442
|
-
security: [{ scheme: "bearer", type: "http" },
|
|
1443
|
-
|
|
1444
|
-
name: "sessionid",
|
|
1445
|
-
type: "apiKey"
|
|
1446
|
-
}],
|
|
1447
|
-
url: "/cfg/accounts/profile/partial/",
|
|
1413
|
+
static cfgAccountsOauthDisconnectCreate(options) {
|
|
1414
|
+
return (options.client ?? client).post({
|
|
1415
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1416
|
+
url: "/cfg/accounts/oauth/disconnect/",
|
|
1448
1417
|
...options,
|
|
1449
1418
|
headers: {
|
|
1450
1419
|
"Content-Type": "application/json",
|
|
1451
|
-
...options
|
|
1420
|
+
...options.headers
|
|
1452
1421
|
}
|
|
1453
1422
|
});
|
|
1454
1423
|
}
|
|
1455
1424
|
/**
|
|
1456
|
-
*
|
|
1425
|
+
* Start GitHub OAuth
|
|
1457
1426
|
*
|
|
1458
|
-
*
|
|
1427
|
+
* Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
|
|
1459
1428
|
*/
|
|
1460
|
-
static
|
|
1461
|
-
return (options?.client ?? client).
|
|
1462
|
-
|
|
1463
|
-
in: "cookie",
|
|
1464
|
-
name: "sessionid",
|
|
1465
|
-
type: "apiKey"
|
|
1466
|
-
}],
|
|
1467
|
-
url: "/cfg/accounts/profile/partial/",
|
|
1468
|
-
...options,
|
|
1469
|
-
headers: {
|
|
1470
|
-
"Content-Type": "application/json",
|
|
1471
|
-
...options?.headers
|
|
1472
|
-
}
|
|
1473
|
-
});
|
|
1474
|
-
}
|
|
1475
|
-
/**
|
|
1476
|
-
* Update user profile
|
|
1477
|
-
*
|
|
1478
|
-
* Update the current authenticated user's profile information.
|
|
1479
|
-
*/
|
|
1480
|
-
static cfgAccountsProfileUpdatePartialUpdate(options) {
|
|
1481
|
-
return (options?.client ?? client).patch({
|
|
1482
|
-
security: [{ scheme: "bearer", type: "http" }, {
|
|
1483
|
-
in: "cookie",
|
|
1484
|
-
name: "sessionid",
|
|
1485
|
-
type: "apiKey"
|
|
1486
|
-
}],
|
|
1487
|
-
url: "/cfg/accounts/profile/update/",
|
|
1429
|
+
static cfgAccountsOauthGithubAuthorizeCreate(options) {
|
|
1430
|
+
return (options?.client ?? client).post({
|
|
1431
|
+
url: "/cfg/accounts/oauth/github/authorize/",
|
|
1488
1432
|
...options,
|
|
1489
1433
|
headers: {
|
|
1490
1434
|
"Content-Type": "application/json",
|
|
@@ -1493,31 +1437,13 @@ var Accounts = class {
|
|
|
1493
1437
|
});
|
|
1494
1438
|
}
|
|
1495
1439
|
/**
|
|
1496
|
-
*
|
|
1440
|
+
* Complete GitHub OAuth
|
|
1497
1441
|
*
|
|
1498
|
-
*
|
|
1499
|
-
*/
|
|
1500
|
-
static cfgAccountsProfileUpdateUpdate(options) {
|
|
1501
|
-
return (options?.client ?? client).put({
|
|
1502
|
-
security: [{ scheme: "bearer", type: "http" }, {
|
|
1503
|
-
in: "cookie",
|
|
1504
|
-
name: "sessionid",
|
|
1505
|
-
type: "apiKey"
|
|
1506
|
-
}],
|
|
1507
|
-
url: "/cfg/accounts/profile/update/",
|
|
1508
|
-
...options,
|
|
1509
|
-
headers: {
|
|
1510
|
-
"Content-Type": "application/json",
|
|
1511
|
-
...options?.headers
|
|
1512
|
-
}
|
|
1513
|
-
});
|
|
1514
|
-
}
|
|
1515
|
-
/**
|
|
1516
|
-
* Refresh JWT token.
|
|
1442
|
+
* Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
|
|
1517
1443
|
*/
|
|
1518
|
-
static
|
|
1444
|
+
static cfgAccountsOauthGithubCallbackCreate(options) {
|
|
1519
1445
|
return (options.client ?? client).post({
|
|
1520
|
-
url: "/cfg/accounts/
|
|
1446
|
+
url: "/cfg/accounts/oauth/github/callback/",
|
|
1521
1447
|
...options,
|
|
1522
1448
|
headers: {
|
|
1523
1449
|
"Content-Type": "application/json",
|
|
@@ -1525,32 +1451,21 @@ var Accounts = class {
|
|
|
1525
1451
|
}
|
|
1526
1452
|
});
|
|
1527
1453
|
}
|
|
1528
|
-
};
|
|
1529
|
-
var OAuth = class {
|
|
1530
|
-
static {
|
|
1531
|
-
__name(this, "OAuth");
|
|
1532
|
-
}
|
|
1533
1454
|
/**
|
|
1534
|
-
* List OAuth
|
|
1455
|
+
* List OAuth providers
|
|
1535
1456
|
*
|
|
1536
|
-
* Get
|
|
1457
|
+
* Get list of available OAuth providers for authentication.
|
|
1537
1458
|
*/
|
|
1538
|
-
static
|
|
1539
|
-
return (options?.client ?? client).get({
|
|
1540
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
1541
|
-
url: "/cfg/accounts/oauth/connections/",
|
|
1542
|
-
...options
|
|
1543
|
-
});
|
|
1459
|
+
static cfgAccountsOauthProvidersRetrieve(options) {
|
|
1460
|
+
return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
|
|
1544
1461
|
}
|
|
1545
1462
|
/**
|
|
1546
|
-
*
|
|
1547
|
-
*
|
|
1548
|
-
* Remove OAuth connection for the specified provider.
|
|
1463
|
+
* Request OTP code to email.
|
|
1549
1464
|
*/
|
|
1550
|
-
static
|
|
1465
|
+
static cfgAccountsOtpRequestCreate(options) {
|
|
1551
1466
|
return (options.client ?? client).post({
|
|
1552
1467
|
security: [{ scheme: "bearer", type: "http" }],
|
|
1553
|
-
url: "/cfg/accounts/
|
|
1468
|
+
url: "/cfg/accounts/otp/request/",
|
|
1554
1469
|
...options,
|
|
1555
1470
|
headers: {
|
|
1556
1471
|
"Content-Type": "application/json",
|
|
@@ -1559,28 +1474,19 @@ var OAuth = class {
|
|
|
1559
1474
|
});
|
|
1560
1475
|
}
|
|
1561
1476
|
/**
|
|
1562
|
-
*
|
|
1477
|
+
* Verify OTP code and return JWT tokens or 2FA session.
|
|
1563
1478
|
*
|
|
1564
|
-
*
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
return (options?.client ?? client).post({
|
|
1568
|
-
url: "/cfg/accounts/oauth/github/authorize/",
|
|
1569
|
-
...options,
|
|
1570
|
-
headers: {
|
|
1571
|
-
"Content-Type": "application/json",
|
|
1572
|
-
...options?.headers
|
|
1573
|
-
}
|
|
1574
|
-
});
|
|
1575
|
-
}
|
|
1576
|
-
/**
|
|
1577
|
-
* Complete GitHub OAuth
|
|
1479
|
+
* If user has 2FA enabled:
|
|
1480
|
+
* - Returns requires_2fa=True with session_id
|
|
1481
|
+
* - Client must complete 2FA verification at /cfg/totp/verify/
|
|
1578
1482
|
*
|
|
1579
|
-
*
|
|
1483
|
+
* If user has no 2FA:
|
|
1484
|
+
* - Returns JWT tokens and user data directly
|
|
1580
1485
|
*/
|
|
1581
|
-
static
|
|
1486
|
+
static cfgAccountsOtpVerifyCreate(options) {
|
|
1582
1487
|
return (options.client ?? client).post({
|
|
1583
|
-
|
|
1488
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1489
|
+
url: "/cfg/accounts/otp/verify/",
|
|
1584
1490
|
...options,
|
|
1585
1491
|
headers: {
|
|
1586
1492
|
"Content-Type": "application/json",
|
|
@@ -1588,19 +1494,6 @@ var OAuth = class {
|
|
|
1588
1494
|
}
|
|
1589
1495
|
});
|
|
1590
1496
|
}
|
|
1591
|
-
/**
|
|
1592
|
-
* List OAuth providers
|
|
1593
|
-
*
|
|
1594
|
-
* Get list of available OAuth providers for authentication.
|
|
1595
|
-
*/
|
|
1596
|
-
static cfgAccountsOauthProvidersRetrieve(options) {
|
|
1597
|
-
return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
|
|
1598
|
-
}
|
|
1599
|
-
};
|
|
1600
|
-
var UserProfile = class {
|
|
1601
|
-
static {
|
|
1602
|
-
__name(this, "UserProfile");
|
|
1603
|
-
}
|
|
1604
1497
|
/**
|
|
1605
1498
|
* Get current user profile
|
|
1606
1499
|
*
|
|
@@ -1740,11 +1633,6 @@ var UserProfile = class {
|
|
|
1740
1633
|
}
|
|
1741
1634
|
});
|
|
1742
1635
|
}
|
|
1743
|
-
};
|
|
1744
|
-
var Auth = class {
|
|
1745
|
-
static {
|
|
1746
|
-
__name(this, "Auth");
|
|
1747
|
-
}
|
|
1748
1636
|
/**
|
|
1749
1637
|
* Refresh JWT token.
|
|
1750
1638
|
*/
|
|
@@ -1758,2250 +1646,431 @@ var Auth = class {
|
|
|
1758
1646
|
}
|
|
1759
1647
|
});
|
|
1760
1648
|
}
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
}
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
import { z as z2 } from "zod";
|
|
1772
|
-
var CentrifugoTokenSchema = z2.object({
|
|
1773
|
-
token: z2.string(),
|
|
1774
|
-
centrifugo_url: z2.string(),
|
|
1775
|
-
expires_at: z2.string().datetime({ offset: true }),
|
|
1776
|
-
channels: z2.array(z2.string())
|
|
1777
|
-
});
|
|
1778
|
-
|
|
1779
|
-
// src/_api/generated/cfg_accounts/schemas/CfgUserUpdateRequest.ts
|
|
1780
|
-
import { z as z3 } from "zod";
|
|
1781
|
-
var CfgUserUpdateRequestSchema = z3.object({
|
|
1782
|
-
first_name: z3.string().max(50).optional(),
|
|
1783
|
-
last_name: z3.string().max(50).optional(),
|
|
1784
|
-
company: z3.string().max(100).optional(),
|
|
1785
|
-
phone: z3.string().max(20).optional(),
|
|
1786
|
-
position: z3.string().max(100).optional(),
|
|
1787
|
-
language: z3.string().max(10).optional()
|
|
1788
|
-
});
|
|
1789
|
-
|
|
1790
|
-
// src/_api/generated/cfg_accounts/schemas/OAuthAuthorizeRequestRequest.ts
|
|
1791
|
-
import { z as z4 } from "zod";
|
|
1792
|
-
var OAuthAuthorizeRequestRequestSchema = z4.object({
|
|
1793
|
-
redirect_uri: z4.string().optional(),
|
|
1794
|
-
source_url: z4.string().optional()
|
|
1795
|
-
});
|
|
1796
|
-
|
|
1797
|
-
// src/_api/generated/cfg_accounts/schemas/OAuthAuthorizeResponse.ts
|
|
1798
|
-
import { z as z5 } from "zod";
|
|
1799
|
-
var OAuthAuthorizeResponseSchema = z5.object({
|
|
1800
|
-
authorization_url: z5.string(),
|
|
1801
|
-
state: z5.string()
|
|
1802
|
-
});
|
|
1803
|
-
|
|
1804
|
-
// src/_api/generated/cfg_accounts/schemas/OAuthCallbackRequestRequest.ts
|
|
1805
|
-
import { z as z6 } from "zod";
|
|
1806
|
-
var OAuthCallbackRequestRequestSchema = z6.object({
|
|
1807
|
-
code: z6.string().min(10).max(500),
|
|
1808
|
-
state: z6.string().min(20).max(100),
|
|
1809
|
-
redirect_uri: z6.string().optional()
|
|
1810
|
-
});
|
|
1811
|
-
|
|
1812
|
-
// src/_api/generated/cfg_accounts/schemas/OAuthConnection.ts
|
|
1813
|
-
import { z as z8 } from "zod";
|
|
1814
|
-
|
|
1815
|
-
// src/_api/generated/cfg_accounts/schemas/ProviderEnum.ts
|
|
1816
|
-
import { z as z7 } from "zod";
|
|
1817
|
-
var ProviderEnumSchema = z7.enum(["github"]);
|
|
1818
|
-
|
|
1819
|
-
// src/_api/generated/cfg_accounts/schemas/OAuthConnection.ts
|
|
1820
|
-
var OAuthConnectionSchema = z8.object({
|
|
1821
|
-
id: z8.number().int(),
|
|
1822
|
-
provider: ProviderEnumSchema,
|
|
1823
|
-
provider_display: z8.string(),
|
|
1824
|
-
provider_username: z8.string(),
|
|
1825
|
-
provider_email: z8.email(),
|
|
1826
|
-
provider_avatar_url: z8.string(),
|
|
1827
|
-
connected_at: z8.string().datetime({ offset: true }),
|
|
1828
|
-
last_login_at: z8.string().datetime({ offset: true })
|
|
1829
|
-
});
|
|
1830
|
-
|
|
1831
|
-
// src/_api/generated/cfg_accounts/schemas/OAuthDisconnectRequestRequest.ts
|
|
1832
|
-
import { z as z9 } from "zod";
|
|
1833
|
-
var OAuthDisconnectRequestRequestSchema = z9.object({
|
|
1834
|
-
provider: ProviderEnumSchema
|
|
1835
|
-
});
|
|
1836
|
-
|
|
1837
|
-
// src/_api/generated/cfg_accounts/schemas/OAuthError.ts
|
|
1838
|
-
import { z as z10 } from "zod";
|
|
1839
|
-
var OAuthErrorSchema = z10.object({
|
|
1840
|
-
error: z10.string(),
|
|
1841
|
-
error_description: z10.string().optional()
|
|
1842
|
-
});
|
|
1843
|
-
|
|
1844
|
-
// src/_api/generated/cfg_accounts/schemas/OAuthProvidersResponse.ts
|
|
1845
|
-
import { z as z11 } from "zod";
|
|
1846
|
-
var OAuthProvidersResponseSchema = z11.object({
|
|
1847
|
-
providers: z11.array(z11.object({}))
|
|
1848
|
-
});
|
|
1849
|
-
|
|
1850
|
-
// src/_api/generated/cfg_accounts/schemas/OAuthTokenResponse.ts
|
|
1851
|
-
import { z as z12 } from "zod";
|
|
1852
|
-
var OAuthTokenResponseSchema = z12.object({
|
|
1853
|
-
requires_2fa: z12.boolean().optional(),
|
|
1854
|
-
session_id: z12.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i).nullable().optional(),
|
|
1855
|
-
access: z12.string().nullable().optional(),
|
|
1856
|
-
refresh: z12.string().nullable().optional(),
|
|
1857
|
-
user: z12.object({}).nullable().optional(),
|
|
1858
|
-
is_new_user: z12.boolean(),
|
|
1859
|
-
is_new_connection: z12.boolean(),
|
|
1860
|
-
should_prompt_2fa: z12.boolean().optional()
|
|
1861
|
-
});
|
|
1862
|
-
|
|
1863
|
-
// src/_api/generated/cfg_accounts/schemas/OTPErrorResponse.ts
|
|
1864
|
-
import { z as z13 } from "zod";
|
|
1865
|
-
var OTPErrorResponseSchema = z13.object({
|
|
1866
|
-
error: z13.string(),
|
|
1867
|
-
error_code: z13.string().nullable().optional(),
|
|
1868
|
-
retry_after: z13.number().int().nullable().optional()
|
|
1869
|
-
});
|
|
1870
|
-
|
|
1871
|
-
// src/_api/generated/cfg_accounts/schemas/OTPRequestRequest.ts
|
|
1872
|
-
import { z as z14 } from "zod";
|
|
1873
|
-
var OTPRequestRequestSchema = z14.object({
|
|
1874
|
-
identifier: z14.string().min(1),
|
|
1875
|
-
source_url: z14.string().optional()
|
|
1876
|
-
});
|
|
1877
|
-
|
|
1878
|
-
// src/_api/generated/cfg_accounts/schemas/OTPRequestResponse.ts
|
|
1879
|
-
import { z as z15 } from "zod";
|
|
1880
|
-
var OTPRequestResponseSchema = z15.object({
|
|
1881
|
-
message: z15.string()
|
|
1882
|
-
});
|
|
1883
|
-
|
|
1884
|
-
// src/_api/generated/cfg_accounts/schemas/OTPVerifyRequest.ts
|
|
1885
|
-
import { z as z16 } from "zod";
|
|
1886
|
-
var OTPVerifyRequestSchema = z16.object({
|
|
1887
|
-
identifier: z16.string().min(1),
|
|
1888
|
-
otp: z16.string().min(6).max(6),
|
|
1889
|
-
source_url: z16.string().optional()
|
|
1890
|
-
});
|
|
1891
|
-
|
|
1892
|
-
// src/_api/generated/cfg_accounts/schemas/OTPVerifyResponse.ts
|
|
1893
|
-
import { z as z18 } from "zod";
|
|
1894
|
-
|
|
1895
|
-
// src/_api/generated/cfg_accounts/schemas/User.ts
|
|
1896
|
-
import { z as z17 } from "zod";
|
|
1897
|
-
var UserSchema = z17.object({
|
|
1898
|
-
id: z17.number().int(),
|
|
1899
|
-
email: z17.email(),
|
|
1900
|
-
first_name: z17.string().max(50).optional(),
|
|
1901
|
-
last_name: z17.string().max(50).optional(),
|
|
1902
|
-
full_name: z17.string(),
|
|
1903
|
-
initials: z17.string(),
|
|
1904
|
-
display_username: z17.string(),
|
|
1905
|
-
company: z17.string().max(100).optional(),
|
|
1906
|
-
phone: z17.string().max(20).optional(),
|
|
1907
|
-
position: z17.string().max(100).optional(),
|
|
1908
|
-
language: z17.string().max(10).optional(),
|
|
1909
|
-
avatar: z17.string().nullable(),
|
|
1910
|
-
is_staff: z17.boolean(),
|
|
1911
|
-
is_superuser: z17.boolean(),
|
|
1912
|
-
date_joined: z17.string().datetime({ offset: true }),
|
|
1913
|
-
last_login: z17.string().datetime({ offset: true }).nullable(),
|
|
1914
|
-
unanswered_messages_count: z17.number().int(),
|
|
1915
|
-
centrifugo: CentrifugoTokenSchema.nullable()
|
|
1916
|
-
});
|
|
1917
|
-
|
|
1918
|
-
// src/_api/generated/cfg_accounts/schemas/OTPVerifyResponse.ts
|
|
1919
|
-
var OTPVerifyResponseSchema = z18.object({
|
|
1920
|
-
requires_2fa: z18.boolean().optional(),
|
|
1921
|
-
session_id: z18.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i).nullable().optional(),
|
|
1922
|
-
refresh: z18.string().nullable().optional(),
|
|
1923
|
-
access: z18.string().nullable().optional(),
|
|
1924
|
-
user: UserSchema.nullable().optional(),
|
|
1925
|
-
should_prompt_2fa: z18.boolean().optional()
|
|
1926
|
-
});
|
|
1927
|
-
|
|
1928
|
-
// src/_api/generated/cfg_accounts/schemas/PatchedCfgUserUpdateRequest.ts
|
|
1929
|
-
import { z as z19 } from "zod";
|
|
1930
|
-
var PatchedCfgUserUpdateRequestSchema = z19.object({
|
|
1931
|
-
first_name: z19.string().max(50).optional(),
|
|
1932
|
-
last_name: z19.string().max(50).optional(),
|
|
1933
|
-
company: z19.string().max(100).optional(),
|
|
1934
|
-
phone: z19.string().max(20).optional(),
|
|
1935
|
-
position: z19.string().max(100).optional(),
|
|
1936
|
-
language: z19.string().max(10).optional()
|
|
1937
|
-
});
|
|
1938
|
-
|
|
1939
|
-
// src/_api/generated/cfg_accounts/schemas/TokenRefresh.ts
|
|
1940
|
-
import { z as z20 } from "zod";
|
|
1941
|
-
var TokenRefreshSchema = z20.object({
|
|
1942
|
-
access: z20.string(),
|
|
1943
|
-
refresh: z20.string()
|
|
1944
|
-
});
|
|
1945
|
-
|
|
1946
|
-
// src/_api/generated/cfg_accounts/schemas/TokenRefreshRequest.ts
|
|
1947
|
-
import { z as z21 } from "zod";
|
|
1948
|
-
var TokenRefreshRequestSchema = z21.object({
|
|
1949
|
-
refresh: z21.string().min(1)
|
|
1950
|
-
});
|
|
1951
|
-
|
|
1952
|
-
// src/_api/generated/_shared/validation-events.ts
|
|
1953
|
-
function dispatchValidationError(detail) {
|
|
1954
|
-
if (typeof window === "undefined") return;
|
|
1955
|
-
try {
|
|
1956
|
-
const event = new CustomEvent("zod-validation-error", {
|
|
1957
|
-
detail,
|
|
1958
|
-
bubbles: true,
|
|
1959
|
-
cancelable: false
|
|
1649
|
+
/**
|
|
1650
|
+
* Get Centrifugo connection token
|
|
1651
|
+
*
|
|
1652
|
+
* Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
|
|
1653
|
+
*/
|
|
1654
|
+
static cfgCentrifugoAuthTokenRetrieve(options) {
|
|
1655
|
+
return (options?.client ?? client).get({
|
|
1656
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1657
|
+
url: "/cfg/centrifugo/auth/token/",
|
|
1658
|
+
...options
|
|
1960
1659
|
});
|
|
1961
|
-
window.dispatchEvent(event);
|
|
1962
|
-
} catch (error) {
|
|
1963
|
-
console.warn("Failed to dispatch validation error event:", error);
|
|
1964
1660
|
}
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
return () => window.removeEventListener("zod-validation-error", handler);
|
|
1975
|
-
}
|
|
1976
|
-
__name(onValidationError, "onValidationError");
|
|
1977
|
-
function formatZodError(error) {
|
|
1978
|
-
const issues = error.issues.map((issue, index) => {
|
|
1979
|
-
const path = issue.path.join(".") || "root";
|
|
1980
|
-
const parts = [`${index + 1}. ${path}: ${issue.message}`];
|
|
1981
|
-
if ("expected" in issue && issue.expected) parts.push(` Expected: ${issue.expected}`);
|
|
1982
|
-
if ("received" in issue && issue.received) parts.push(` Received: ${issue.received}`);
|
|
1983
|
-
return parts.join("\n");
|
|
1984
|
-
});
|
|
1985
|
-
return issues.join("\n");
|
|
1986
|
-
}
|
|
1987
|
-
__name(formatZodError, "formatZodError");
|
|
1988
|
-
|
|
1989
|
-
// src/_api/generated/cfg_accounts/api.ts
|
|
1990
|
-
var ACCESS_KEY = "cfg.access_token";
|
|
1991
|
-
var REFRESH_KEY = "cfg.refresh_token";
|
|
1992
|
-
var VALIDATION_ROUTES = [
|
|
1993
|
-
{ method: "POST", re: new RegExp("^/cfg/accounts/oauth/github/authorize/?$"), schema: OAuthAuthorizeResponseSchema, path: "/cfg/accounts/oauth/github/authorize/" },
|
|
1994
|
-
{ method: "POST", re: new RegExp("^/cfg/accounts/oauth/github/callback/?$"), schema: OAuthTokenResponseSchema, path: "/cfg/accounts/oauth/github/callback/" },
|
|
1995
|
-
{ method: "GET", re: new RegExp("^/cfg/accounts/oauth/providers/?$"), schema: OAuthProvidersResponseSchema, path: "/cfg/accounts/oauth/providers/" },
|
|
1996
|
-
{ method: "POST", re: new RegExp("^/cfg/accounts/otp/request/?$"), schema: OTPRequestResponseSchema, path: "/cfg/accounts/otp/request/" },
|
|
1997
|
-
{ method: "POST", re: new RegExp("^/cfg/accounts/otp/verify/?$"), schema: OTPVerifyResponseSchema, path: "/cfg/accounts/otp/verify/" },
|
|
1998
|
-
{ method: "GET", re: new RegExp("^/cfg/accounts/profile/?$"), schema: UserSchema, path: "/cfg/accounts/profile/" },
|
|
1999
|
-
{ method: "POST", re: new RegExp("^/cfg/accounts/profile/avatar/?$"), schema: UserSchema, path: "/cfg/accounts/profile/avatar/" },
|
|
2000
|
-
{ method: "POST", re: new RegExp("^/cfg/accounts/profile/delete/?$"), schema: AccountDeleteResponseSchema, path: "/cfg/accounts/profile/delete/" },
|
|
2001
|
-
{ method: "PUT", re: new RegExp("^/cfg/accounts/profile/partial/?$"), schema: UserSchema, path: "/cfg/accounts/profile/partial/" },
|
|
2002
|
-
{ method: "PATCH", re: new RegExp("^/cfg/accounts/profile/partial/?$"), schema: UserSchema, path: "/cfg/accounts/profile/partial/" },
|
|
2003
|
-
{ method: "PUT", re: new RegExp("^/cfg/accounts/profile/update/?$"), schema: UserSchema, path: "/cfg/accounts/profile/update/" },
|
|
2004
|
-
{ method: "PATCH", re: new RegExp("^/cfg/accounts/profile/update/?$"), schema: UserSchema, path: "/cfg/accounts/profile/update/" },
|
|
2005
|
-
{ method: "POST", re: new RegExp("^/cfg/accounts/token/refresh/?$"), schema: TokenRefreshSchema, path: "/cfg/accounts/token/refresh/" }
|
|
2006
|
-
];
|
|
2007
|
-
function detectLocale() {
|
|
2008
|
-
try {
|
|
2009
|
-
if (typeof document !== "undefined") {
|
|
2010
|
-
const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
2011
|
-
if (m) return decodeURIComponent(m[1]);
|
|
2012
|
-
}
|
|
2013
|
-
if (typeof navigator !== "undefined" && navigator.language) {
|
|
2014
|
-
return navigator.language;
|
|
2015
|
-
}
|
|
2016
|
-
} catch {
|
|
1661
|
+
/**
|
|
1662
|
+
* Get backup codes status for user.
|
|
1663
|
+
*/
|
|
1664
|
+
static cfgTotpBackupCodesRetrieve(options) {
|
|
1665
|
+
return (options?.client ?? client).get({
|
|
1666
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1667
|
+
url: "/cfg/totp/backup-codes/",
|
|
1668
|
+
...options
|
|
1669
|
+
});
|
|
2017
1670
|
}
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
1671
|
+
/**
|
|
1672
|
+
* Regenerate backup codes.
|
|
1673
|
+
*
|
|
1674
|
+
* Requires TOTP code for verification.
|
|
1675
|
+
* Invalidates all existing codes.
|
|
1676
|
+
*/
|
|
1677
|
+
static cfgTotpBackupCodesRegenerateCreate(options) {
|
|
1678
|
+
return (options.client ?? client).post({
|
|
1679
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1680
|
+
url: "/cfg/totp/backup-codes/regenerate/",
|
|
1681
|
+
...options,
|
|
1682
|
+
headers: {
|
|
1683
|
+
"Content-Type": "application/json",
|
|
1684
|
+
...options.headers
|
|
1685
|
+
}
|
|
1686
|
+
});
|
|
2024
1687
|
}
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
userProfile = UserProfile;
|
|
2034
|
-
auth = Auth;
|
|
2035
|
-
constructor(baseUrl2, opts = {}) {
|
|
2036
|
-
this.baseUrl = baseUrl2.replace(/\/$/, "");
|
|
2037
|
-
this.storage = opts.storage ?? new LocalStorageAdapter();
|
|
2038
|
-
this.logger = new APILogger(opts.logger);
|
|
2039
|
-
this.locale = opts.locale ?? null;
|
|
2040
|
-
this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
|
|
2041
|
-
const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
|
|
2042
|
-
client.setConfig({ baseUrl: this.baseUrl, credentials });
|
|
2043
|
-
client.interceptors.request.use((request) => {
|
|
2044
|
-
const access = this.getToken();
|
|
2045
|
-
if (access) request.headers.set("Authorization", `Bearer ${access}`);
|
|
2046
|
-
const locale = this.locale ?? detectLocale();
|
|
2047
|
-
if (locale) request.headers.set("Accept-Language", locale);
|
|
2048
|
-
if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
|
|
2049
|
-
return request;
|
|
1688
|
+
/**
|
|
1689
|
+
* List all TOTP devices for user.
|
|
1690
|
+
*/
|
|
1691
|
+
static cfgTotpDevicesRetrieve(options) {
|
|
1692
|
+
return (options?.client ?? client).get({
|
|
1693
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1694
|
+
url: "/cfg/totp/devices/",
|
|
1695
|
+
...options
|
|
2050
1696
|
});
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
try {
|
|
2063
|
-
payload = await response.clone().json();
|
|
2064
|
-
} catch {
|
|
2065
|
-
return response;
|
|
2066
|
-
}
|
|
2067
|
-
const result = route.schema.safeParse(payload);
|
|
2068
|
-
if (!result.success) {
|
|
2069
|
-
dispatchValidationError({
|
|
2070
|
-
operation: `${method} ${route.path}`,
|
|
2071
|
-
path: route.path,
|
|
2072
|
-
method,
|
|
2073
|
-
error: result.error,
|
|
2074
|
-
response: payload,
|
|
2075
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
2076
|
-
});
|
|
2077
|
-
}
|
|
2078
|
-
return response;
|
|
1697
|
+
}
|
|
1698
|
+
/**
|
|
1699
|
+
* Delete a TOTP device.
|
|
1700
|
+
*
|
|
1701
|
+
* Requires verification code if removing the last/primary device.
|
|
1702
|
+
*/
|
|
1703
|
+
static cfgTotpDevicesDestroy(options) {
|
|
1704
|
+
return (options.client ?? client).delete({
|
|
1705
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1706
|
+
url: "/cfg/totp/devices/{id}/",
|
|
1707
|
+
...options
|
|
2079
1708
|
});
|
|
2080
1709
|
}
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
1710
|
+
/**
|
|
1711
|
+
* Completely disable 2FA for account.
|
|
1712
|
+
*
|
|
1713
|
+
* Requires verification code.
|
|
1714
|
+
*/
|
|
1715
|
+
static cfgTotpDisableCreate(options) {
|
|
1716
|
+
return (options.client ?? client).post({
|
|
1717
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1718
|
+
url: "/cfg/totp/disable/",
|
|
1719
|
+
...options,
|
|
1720
|
+
headers: {
|
|
1721
|
+
"Content-Type": "application/json",
|
|
1722
|
+
...options.headers
|
|
1723
|
+
}
|
|
1724
|
+
});
|
|
2084
1725
|
}
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
1726
|
+
/**
|
|
1727
|
+
* Start 2FA setup process.
|
|
1728
|
+
*
|
|
1729
|
+
* Creates a new TOTP device and returns QR code for scanning.
|
|
1730
|
+
*/
|
|
1731
|
+
static cfgTotpSetupCreate(options) {
|
|
1732
|
+
return (options?.client ?? client).post({
|
|
1733
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1734
|
+
url: "/cfg/totp/setup/",
|
|
1735
|
+
...options,
|
|
1736
|
+
headers: {
|
|
1737
|
+
"Content-Type": "application/json",
|
|
1738
|
+
...options?.headers
|
|
1739
|
+
}
|
|
1740
|
+
});
|
|
2088
1741
|
}
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
1742
|
+
/**
|
|
1743
|
+
* Confirm 2FA setup with first valid code.
|
|
1744
|
+
*
|
|
1745
|
+
* Activates the device and generates backup codes.
|
|
1746
|
+
*/
|
|
1747
|
+
static cfgTotpSetupConfirmCreate(options) {
|
|
1748
|
+
return (options.client ?? client).post({
|
|
1749
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1750
|
+
url: "/cfg/totp/setup/confirm/",
|
|
1751
|
+
...options,
|
|
1752
|
+
headers: {
|
|
1753
|
+
"Content-Type": "application/json",
|
|
1754
|
+
...options.headers
|
|
1755
|
+
}
|
|
1756
|
+
});
|
|
2092
1757
|
}
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
1758
|
+
/**
|
|
1759
|
+
* Verify TOTP code for 2FA session.
|
|
1760
|
+
*
|
|
1761
|
+
* Completes authentication and returns JWT tokens on success.
|
|
1762
|
+
*/
|
|
1763
|
+
static cfgTotpVerifyCreate(options) {
|
|
1764
|
+
return (options.client ?? client).post({
|
|
1765
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1766
|
+
url: "/cfg/totp/verify/",
|
|
1767
|
+
...options,
|
|
1768
|
+
headers: {
|
|
1769
|
+
"Content-Type": "application/json",
|
|
1770
|
+
...options.headers
|
|
1771
|
+
}
|
|
1772
|
+
});
|
|
2096
1773
|
}
|
|
2097
|
-
|
|
2098
|
-
|
|
1774
|
+
/**
|
|
1775
|
+
* Verify backup recovery code for 2FA session.
|
|
1776
|
+
*
|
|
1777
|
+
* Alternative verification method when TOTP device unavailable.
|
|
1778
|
+
*/
|
|
1779
|
+
static cfgTotpVerifyBackupCreate(options) {
|
|
1780
|
+
return (options.client ?? client).post({
|
|
1781
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1782
|
+
url: "/cfg/totp/verify/backup/",
|
|
1783
|
+
...options,
|
|
1784
|
+
headers: {
|
|
1785
|
+
"Content-Type": "application/json",
|
|
1786
|
+
...options.headers
|
|
1787
|
+
}
|
|
1788
|
+
});
|
|
2099
1789
|
}
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
1790
|
+
};
|
|
1791
|
+
var Accounts = class {
|
|
1792
|
+
static {
|
|
1793
|
+
__name(this, "Accounts");
|
|
2103
1794
|
}
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
1795
|
+
/**
|
|
1796
|
+
* List OAuth connections
|
|
1797
|
+
*
|
|
1798
|
+
* Get all OAuth connections for the current user.
|
|
1799
|
+
*/
|
|
1800
|
+
static cfgAccountsOauthConnectionsList(options) {
|
|
1801
|
+
return (options?.client ?? client).get({
|
|
1802
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1803
|
+
url: "/cfg/accounts/oauth/connections/",
|
|
1804
|
+
...options
|
|
1805
|
+
});
|
|
2107
1806
|
}
|
|
2108
|
-
|
|
2109
|
-
|
|
1807
|
+
/**
|
|
1808
|
+
* Disconnect OAuth provider
|
|
1809
|
+
*
|
|
1810
|
+
* Remove OAuth connection for the specified provider.
|
|
1811
|
+
*/
|
|
1812
|
+
static cfgAccountsOauthDisconnectCreate(options) {
|
|
1813
|
+
return (options.client ?? client).post({
|
|
1814
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1815
|
+
url: "/cfg/accounts/oauth/disconnect/",
|
|
1816
|
+
...options,
|
|
1817
|
+
headers: {
|
|
1818
|
+
"Content-Type": "application/json",
|
|
1819
|
+
...options.headers
|
|
1820
|
+
}
|
|
1821
|
+
});
|
|
2110
1822
|
}
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
1823
|
+
/**
|
|
1824
|
+
* Start GitHub OAuth
|
|
1825
|
+
*
|
|
1826
|
+
* Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
|
|
1827
|
+
*/
|
|
1828
|
+
static cfgAccountsOauthGithubAuthorizeCreate(options) {
|
|
1829
|
+
return (options?.client ?? client).post({
|
|
1830
|
+
url: "/cfg/accounts/oauth/github/authorize/",
|
|
1831
|
+
...options,
|
|
1832
|
+
headers: {
|
|
1833
|
+
"Content-Type": "application/json",
|
|
1834
|
+
...options?.headers
|
|
1835
|
+
}
|
|
1836
|
+
});
|
|
2114
1837
|
}
|
|
2115
|
-
|
|
2116
|
-
|
|
1838
|
+
/**
|
|
1839
|
+
* Complete GitHub OAuth
|
|
1840
|
+
*
|
|
1841
|
+
* Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
|
|
1842
|
+
*/
|
|
1843
|
+
static cfgAccountsOauthGithubCallbackCreate(options) {
|
|
1844
|
+
return (options.client ?? client).post({
|
|
1845
|
+
url: "/cfg/accounts/oauth/github/callback/",
|
|
1846
|
+
...options,
|
|
1847
|
+
headers: {
|
|
1848
|
+
"Content-Type": "application/json",
|
|
1849
|
+
...options.headers
|
|
1850
|
+
}
|
|
1851
|
+
});
|
|
2117
1852
|
}
|
|
2118
|
-
|
|
2119
|
-
|
|
1853
|
+
/**
|
|
1854
|
+
* List OAuth providers
|
|
1855
|
+
*
|
|
1856
|
+
* Get list of available OAuth providers for authentication.
|
|
1857
|
+
*/
|
|
1858
|
+
static cfgAccountsOauthProvidersRetrieve(options) {
|
|
1859
|
+
return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
|
|
2120
1860
|
}
|
|
2121
|
-
|
|
2122
|
-
|
|
1861
|
+
/**
|
|
1862
|
+
* Request OTP code to email.
|
|
1863
|
+
*/
|
|
1864
|
+
static cfgAccountsOtpRequestCreate(options) {
|
|
1865
|
+
return (options.client ?? client).post({
|
|
1866
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1867
|
+
url: "/cfg/accounts/otp/request/",
|
|
1868
|
+
...options,
|
|
1869
|
+
headers: {
|
|
1870
|
+
"Content-Type": "application/json",
|
|
1871
|
+
...options.headers
|
|
1872
|
+
}
|
|
1873
|
+
});
|
|
2123
1874
|
}
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
1875
|
+
/**
|
|
1876
|
+
* Verify OTP code and return JWT tokens or 2FA session.
|
|
1877
|
+
*
|
|
1878
|
+
* If user has 2FA enabled:
|
|
1879
|
+
* - Returns requires_2fa=True with session_id
|
|
1880
|
+
* - Client must complete 2FA verification at /cfg/totp/verify/
|
|
1881
|
+
*
|
|
1882
|
+
* If user has no 2FA:
|
|
1883
|
+
* - Returns JWT tokens and user data directly
|
|
1884
|
+
*/
|
|
1885
|
+
static cfgAccountsOtpVerifyCreate(options) {
|
|
1886
|
+
return (options.client ?? client).post({
|
|
1887
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1888
|
+
url: "/cfg/accounts/otp/verify/",
|
|
1889
|
+
...options,
|
|
1890
|
+
headers: {
|
|
1891
|
+
"Content-Type": "application/json",
|
|
1892
|
+
...options.headers
|
|
1893
|
+
}
|
|
1894
|
+
});
|
|
2135
1895
|
}
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
}
|
|
2152
|
-
return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
|
|
2153
|
-
}
|
|
2154
|
-
get errorMessage() {
|
|
2155
|
-
const details = this.details;
|
|
2156
|
-
if (!details) return this.message;
|
|
2157
|
-
if (details.detail) {
|
|
2158
|
-
return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
|
|
2159
|
-
}
|
|
2160
|
-
if (details.error) return String(details.error);
|
|
2161
|
-
if (details.message) return String(details.message);
|
|
2162
|
-
const fieldErrors = this.fieldErrors;
|
|
2163
|
-
if (fieldErrors) {
|
|
2164
|
-
const firstField = Object.keys(fieldErrors)[0];
|
|
2165
|
-
if (firstField) return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
|
|
2166
|
-
}
|
|
2167
|
-
return this.message;
|
|
2168
|
-
}
|
|
2169
|
-
get isValidationError() {
|
|
2170
|
-
return this.statusCode === 400;
|
|
2171
|
-
}
|
|
2172
|
-
get isAuthError() {
|
|
2173
|
-
return this.statusCode === 401;
|
|
2174
|
-
}
|
|
2175
|
-
get isPermissionError() {
|
|
2176
|
-
return this.statusCode === 403;
|
|
2177
|
-
}
|
|
2178
|
-
get isNotFoundError() {
|
|
2179
|
-
return this.statusCode === 404;
|
|
2180
|
-
}
|
|
2181
|
-
get isServerError() {
|
|
2182
|
-
return this.statusCode >= 500 && this.statusCode < 600;
|
|
2183
|
-
}
|
|
2184
|
-
};
|
|
2185
|
-
var NetworkError = class extends Error {
|
|
2186
|
-
constructor(message, url, originalError) {
|
|
2187
|
-
super(message);
|
|
2188
|
-
this.url = url;
|
|
2189
|
-
this.originalError = originalError;
|
|
2190
|
-
this.name = "NetworkError";
|
|
2191
|
-
}
|
|
2192
|
-
static {
|
|
2193
|
-
__name(this, "NetworkError");
|
|
2194
|
-
}
|
|
2195
|
-
};
|
|
2196
|
-
|
|
2197
|
-
// src/_api/generated/cfg_centrifugo/core/bodySerializer.gen.ts
|
|
2198
|
-
var jsonBodySerializer2 = {
|
|
2199
|
-
bodySerializer: /* @__PURE__ */ __name((body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value), "bodySerializer")
|
|
2200
|
-
};
|
|
2201
|
-
|
|
2202
|
-
// src/_api/generated/cfg_centrifugo/core/params.gen.ts
|
|
2203
|
-
var extraPrefixesMap2 = {
|
|
2204
|
-
$body_: "body",
|
|
2205
|
-
$headers_: "headers",
|
|
2206
|
-
$path_: "path",
|
|
2207
|
-
$query_: "query"
|
|
2208
|
-
};
|
|
2209
|
-
var extraPrefixes2 = Object.entries(extraPrefixesMap2);
|
|
2210
|
-
|
|
2211
|
-
// src/_api/generated/cfg_centrifugo/core/serverSentEvents.gen.ts
|
|
2212
|
-
function createSseClient2({
|
|
2213
|
-
onRequest,
|
|
2214
|
-
onSseError,
|
|
2215
|
-
onSseEvent,
|
|
2216
|
-
responseTransformer,
|
|
2217
|
-
responseValidator,
|
|
2218
|
-
sseDefaultRetryDelay,
|
|
2219
|
-
sseMaxRetryAttempts,
|
|
2220
|
-
sseMaxRetryDelay,
|
|
2221
|
-
sseSleepFn,
|
|
2222
|
-
url,
|
|
2223
|
-
...options
|
|
2224
|
-
}) {
|
|
2225
|
-
let lastEventId;
|
|
2226
|
-
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
2227
|
-
const createStream = /* @__PURE__ */ __name(async function* () {
|
|
2228
|
-
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
2229
|
-
let attempt = 0;
|
|
2230
|
-
const signal = options.signal ?? new AbortController().signal;
|
|
2231
|
-
while (true) {
|
|
2232
|
-
if (signal.aborted) break;
|
|
2233
|
-
attempt++;
|
|
2234
|
-
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
2235
|
-
if (lastEventId !== void 0) {
|
|
2236
|
-
headers.set("Last-Event-ID", lastEventId);
|
|
2237
|
-
}
|
|
2238
|
-
try {
|
|
2239
|
-
const requestInit = {
|
|
2240
|
-
redirect: "follow",
|
|
2241
|
-
...options,
|
|
2242
|
-
body: options.serializedBody,
|
|
2243
|
-
headers,
|
|
2244
|
-
signal
|
|
2245
|
-
};
|
|
2246
|
-
let request = new Request(url, requestInit);
|
|
2247
|
-
if (onRequest) {
|
|
2248
|
-
request = await onRequest(url, requestInit);
|
|
2249
|
-
}
|
|
2250
|
-
const _fetch = options.fetch ?? globalThis.fetch;
|
|
2251
|
-
const response = await _fetch(request);
|
|
2252
|
-
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
2253
|
-
if (!response.body) throw new Error("No body in SSE response");
|
|
2254
|
-
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
2255
|
-
let buffer = "";
|
|
2256
|
-
const abortHandler = /* @__PURE__ */ __name(() => {
|
|
2257
|
-
try {
|
|
2258
|
-
reader.cancel();
|
|
2259
|
-
} catch {
|
|
2260
|
-
}
|
|
2261
|
-
}, "abortHandler");
|
|
2262
|
-
signal.addEventListener("abort", abortHandler);
|
|
2263
|
-
try {
|
|
2264
|
-
while (true) {
|
|
2265
|
-
const { done, value } = await reader.read();
|
|
2266
|
-
if (done) break;
|
|
2267
|
-
buffer += value;
|
|
2268
|
-
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
2269
|
-
const chunks = buffer.split("\n\n");
|
|
2270
|
-
buffer = chunks.pop() ?? "";
|
|
2271
|
-
for (const chunk of chunks) {
|
|
2272
|
-
const lines = chunk.split("\n");
|
|
2273
|
-
const dataLines = [];
|
|
2274
|
-
let eventName;
|
|
2275
|
-
for (const line of lines) {
|
|
2276
|
-
if (line.startsWith("data:")) {
|
|
2277
|
-
dataLines.push(line.replace(/^data:\s*/, ""));
|
|
2278
|
-
} else if (line.startsWith("event:")) {
|
|
2279
|
-
eventName = line.replace(/^event:\s*/, "");
|
|
2280
|
-
} else if (line.startsWith("id:")) {
|
|
2281
|
-
lastEventId = line.replace(/^id:\s*/, "");
|
|
2282
|
-
} else if (line.startsWith("retry:")) {
|
|
2283
|
-
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
|
2284
|
-
if (!Number.isNaN(parsed)) {
|
|
2285
|
-
retryDelay = parsed;
|
|
2286
|
-
}
|
|
2287
|
-
}
|
|
2288
|
-
}
|
|
2289
|
-
let data;
|
|
2290
|
-
let parsedJson = false;
|
|
2291
|
-
if (dataLines.length) {
|
|
2292
|
-
const rawData = dataLines.join("\n");
|
|
2293
|
-
try {
|
|
2294
|
-
data = JSON.parse(rawData);
|
|
2295
|
-
parsedJson = true;
|
|
2296
|
-
} catch {
|
|
2297
|
-
data = rawData;
|
|
2298
|
-
}
|
|
2299
|
-
}
|
|
2300
|
-
if (parsedJson) {
|
|
2301
|
-
if (responseValidator) {
|
|
2302
|
-
await responseValidator(data);
|
|
2303
|
-
}
|
|
2304
|
-
if (responseTransformer) {
|
|
2305
|
-
data = await responseTransformer(data);
|
|
2306
|
-
}
|
|
2307
|
-
}
|
|
2308
|
-
onSseEvent?.({
|
|
2309
|
-
data,
|
|
2310
|
-
event: eventName,
|
|
2311
|
-
id: lastEventId,
|
|
2312
|
-
retry: retryDelay
|
|
2313
|
-
});
|
|
2314
|
-
if (dataLines.length) {
|
|
2315
|
-
yield data;
|
|
2316
|
-
}
|
|
2317
|
-
}
|
|
2318
|
-
}
|
|
2319
|
-
} finally {
|
|
2320
|
-
signal.removeEventListener("abort", abortHandler);
|
|
2321
|
-
reader.releaseLock();
|
|
2322
|
-
}
|
|
2323
|
-
break;
|
|
2324
|
-
} catch (error) {
|
|
2325
|
-
onSseError?.(error);
|
|
2326
|
-
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
|
|
2327
|
-
break;
|
|
2328
|
-
}
|
|
2329
|
-
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
|
|
2330
|
-
await sleep(backoff);
|
|
2331
|
-
}
|
|
2332
|
-
}
|
|
2333
|
-
}, "createStream");
|
|
2334
|
-
const stream = createStream();
|
|
2335
|
-
return { stream };
|
|
2336
|
-
}
|
|
2337
|
-
__name(createSseClient2, "createSseClient");
|
|
2338
|
-
|
|
2339
|
-
// src/_api/generated/cfg_centrifugo/core/pathSerializer.gen.ts
|
|
2340
|
-
var separatorArrayExplode2 = /* @__PURE__ */ __name((style) => {
|
|
2341
|
-
switch (style) {
|
|
2342
|
-
case "label":
|
|
2343
|
-
return ".";
|
|
2344
|
-
case "matrix":
|
|
2345
|
-
return ";";
|
|
2346
|
-
case "simple":
|
|
2347
|
-
return ",";
|
|
2348
|
-
default:
|
|
2349
|
-
return "&";
|
|
2350
|
-
}
|
|
2351
|
-
}, "separatorArrayExplode");
|
|
2352
|
-
var separatorArrayNoExplode2 = /* @__PURE__ */ __name((style) => {
|
|
2353
|
-
switch (style) {
|
|
2354
|
-
case "form":
|
|
2355
|
-
return ",";
|
|
2356
|
-
case "pipeDelimited":
|
|
2357
|
-
return "|";
|
|
2358
|
-
case "spaceDelimited":
|
|
2359
|
-
return "%20";
|
|
2360
|
-
default:
|
|
2361
|
-
return ",";
|
|
2362
|
-
}
|
|
2363
|
-
}, "separatorArrayNoExplode");
|
|
2364
|
-
var separatorObjectExplode2 = /* @__PURE__ */ __name((style) => {
|
|
2365
|
-
switch (style) {
|
|
2366
|
-
case "label":
|
|
2367
|
-
return ".";
|
|
2368
|
-
case "matrix":
|
|
2369
|
-
return ";";
|
|
2370
|
-
case "simple":
|
|
2371
|
-
return ",";
|
|
2372
|
-
default:
|
|
2373
|
-
return "&";
|
|
2374
|
-
}
|
|
2375
|
-
}, "separatorObjectExplode");
|
|
2376
|
-
var serializeArrayParam2 = /* @__PURE__ */ __name(({
|
|
2377
|
-
allowReserved,
|
|
2378
|
-
explode,
|
|
2379
|
-
name,
|
|
2380
|
-
style,
|
|
2381
|
-
value
|
|
2382
|
-
}) => {
|
|
2383
|
-
if (!explode) {
|
|
2384
|
-
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode2(style));
|
|
2385
|
-
switch (style) {
|
|
2386
|
-
case "label":
|
|
2387
|
-
return `.${joinedValues2}`;
|
|
2388
|
-
case "matrix":
|
|
2389
|
-
return `;${name}=${joinedValues2}`;
|
|
2390
|
-
case "simple":
|
|
2391
|
-
return joinedValues2;
|
|
2392
|
-
default:
|
|
2393
|
-
return `${name}=${joinedValues2}`;
|
|
2394
|
-
}
|
|
2395
|
-
}
|
|
2396
|
-
const separator = separatorArrayExplode2(style);
|
|
2397
|
-
const joinedValues = value.map((v) => {
|
|
2398
|
-
if (style === "label" || style === "simple") {
|
|
2399
|
-
return allowReserved ? v : encodeURIComponent(v);
|
|
2400
|
-
}
|
|
2401
|
-
return serializePrimitiveParam2({
|
|
2402
|
-
allowReserved,
|
|
2403
|
-
name,
|
|
2404
|
-
value: v
|
|
2405
|
-
});
|
|
2406
|
-
}).join(separator);
|
|
2407
|
-
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
2408
|
-
}, "serializeArrayParam");
|
|
2409
|
-
var serializePrimitiveParam2 = /* @__PURE__ */ __name(({
|
|
2410
|
-
allowReserved,
|
|
2411
|
-
name,
|
|
2412
|
-
value
|
|
2413
|
-
}) => {
|
|
2414
|
-
if (value === void 0 || value === null) {
|
|
2415
|
-
return "";
|
|
2416
|
-
}
|
|
2417
|
-
if (typeof value === "object") {
|
|
2418
|
-
throw new Error(
|
|
2419
|
-
"Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
|
|
2420
|
-
);
|
|
2421
|
-
}
|
|
2422
|
-
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
2423
|
-
}, "serializePrimitiveParam");
|
|
2424
|
-
var serializeObjectParam2 = /* @__PURE__ */ __name(({
|
|
2425
|
-
allowReserved,
|
|
2426
|
-
explode,
|
|
2427
|
-
name,
|
|
2428
|
-
style,
|
|
2429
|
-
value,
|
|
2430
|
-
valueOnly
|
|
2431
|
-
}) => {
|
|
2432
|
-
if (value instanceof Date) {
|
|
2433
|
-
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
2434
|
-
}
|
|
2435
|
-
if (style !== "deepObject" && !explode) {
|
|
2436
|
-
let values = [];
|
|
2437
|
-
Object.entries(value).forEach(([key, v]) => {
|
|
2438
|
-
values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
|
|
2439
|
-
});
|
|
2440
|
-
const joinedValues2 = values.join(",");
|
|
2441
|
-
switch (style) {
|
|
2442
|
-
case "form":
|
|
2443
|
-
return `${name}=${joinedValues2}`;
|
|
2444
|
-
case "label":
|
|
2445
|
-
return `.${joinedValues2}`;
|
|
2446
|
-
case "matrix":
|
|
2447
|
-
return `;${name}=${joinedValues2}`;
|
|
2448
|
-
default:
|
|
2449
|
-
return joinedValues2;
|
|
2450
|
-
}
|
|
2451
|
-
}
|
|
2452
|
-
const separator = separatorObjectExplode2(style);
|
|
2453
|
-
const joinedValues = Object.entries(value).map(
|
|
2454
|
-
([key, v]) => serializePrimitiveParam2({
|
|
2455
|
-
allowReserved,
|
|
2456
|
-
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
2457
|
-
value: v
|
|
2458
|
-
})
|
|
2459
|
-
).join(separator);
|
|
2460
|
-
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
2461
|
-
}, "serializeObjectParam");
|
|
2462
|
-
|
|
2463
|
-
// src/_api/generated/cfg_centrifugo/core/utils.gen.ts
|
|
2464
|
-
var PATH_PARAM_RE2 = /\{[^{}]+\}/g;
|
|
2465
|
-
var defaultPathSerializer2 = /* @__PURE__ */ __name(({ path, url: _url }) => {
|
|
2466
|
-
let url = _url;
|
|
2467
|
-
const matches = _url.match(PATH_PARAM_RE2);
|
|
2468
|
-
if (matches) {
|
|
2469
|
-
for (const match of matches) {
|
|
2470
|
-
let explode = false;
|
|
2471
|
-
let name = match.substring(1, match.length - 1);
|
|
2472
|
-
let style = "simple";
|
|
2473
|
-
if (name.endsWith("*")) {
|
|
2474
|
-
explode = true;
|
|
2475
|
-
name = name.substring(0, name.length - 1);
|
|
2476
|
-
}
|
|
2477
|
-
if (name.startsWith(".")) {
|
|
2478
|
-
name = name.substring(1);
|
|
2479
|
-
style = "label";
|
|
2480
|
-
} else if (name.startsWith(";")) {
|
|
2481
|
-
name = name.substring(1);
|
|
2482
|
-
style = "matrix";
|
|
2483
|
-
}
|
|
2484
|
-
const value = path[name];
|
|
2485
|
-
if (value === void 0 || value === null) {
|
|
2486
|
-
continue;
|
|
2487
|
-
}
|
|
2488
|
-
if (Array.isArray(value)) {
|
|
2489
|
-
url = url.replace(match, serializeArrayParam2({ explode, name, style, value }));
|
|
2490
|
-
continue;
|
|
2491
|
-
}
|
|
2492
|
-
if (typeof value === "object") {
|
|
2493
|
-
url = url.replace(
|
|
2494
|
-
match,
|
|
2495
|
-
serializeObjectParam2({
|
|
2496
|
-
explode,
|
|
2497
|
-
name,
|
|
2498
|
-
style,
|
|
2499
|
-
value,
|
|
2500
|
-
valueOnly: true
|
|
2501
|
-
})
|
|
2502
|
-
);
|
|
2503
|
-
continue;
|
|
2504
|
-
}
|
|
2505
|
-
if (style === "matrix") {
|
|
2506
|
-
url = url.replace(
|
|
2507
|
-
match,
|
|
2508
|
-
`;${serializePrimitiveParam2({
|
|
2509
|
-
name,
|
|
2510
|
-
value
|
|
2511
|
-
})}`
|
|
2512
|
-
);
|
|
2513
|
-
continue;
|
|
2514
|
-
}
|
|
2515
|
-
const replaceValue = encodeURIComponent(
|
|
2516
|
-
style === "label" ? `.${value}` : value
|
|
2517
|
-
);
|
|
2518
|
-
url = url.replace(match, replaceValue);
|
|
2519
|
-
}
|
|
2520
|
-
}
|
|
2521
|
-
return url;
|
|
2522
|
-
}, "defaultPathSerializer");
|
|
2523
|
-
var getUrl2 = /* @__PURE__ */ __name(({
|
|
2524
|
-
baseUrl: baseUrl2,
|
|
2525
|
-
path,
|
|
2526
|
-
query,
|
|
2527
|
-
querySerializer,
|
|
2528
|
-
url: _url
|
|
2529
|
-
}) => {
|
|
2530
|
-
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
2531
|
-
let url = (baseUrl2 ?? "") + pathUrl;
|
|
2532
|
-
if (path) {
|
|
2533
|
-
url = defaultPathSerializer2({ path, url });
|
|
2534
|
-
}
|
|
2535
|
-
let search = query ? querySerializer(query) : "";
|
|
2536
|
-
if (search.startsWith("?")) {
|
|
2537
|
-
search = search.substring(1);
|
|
2538
|
-
}
|
|
2539
|
-
if (search) {
|
|
2540
|
-
url += `?${search}`;
|
|
2541
|
-
}
|
|
2542
|
-
return url;
|
|
2543
|
-
}, "getUrl");
|
|
2544
|
-
function getValidRequestBody2(options) {
|
|
2545
|
-
const hasBody = options.body !== void 0;
|
|
2546
|
-
const isSerializedBody = hasBody && options.bodySerializer;
|
|
2547
|
-
if (isSerializedBody) {
|
|
2548
|
-
if ("serializedBody" in options) {
|
|
2549
|
-
const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
|
|
2550
|
-
return hasSerializedBody ? options.serializedBody : null;
|
|
2551
|
-
}
|
|
2552
|
-
return options.body !== "" ? options.body : null;
|
|
2553
|
-
}
|
|
2554
|
-
if (hasBody) {
|
|
2555
|
-
return options.body;
|
|
2556
|
-
}
|
|
2557
|
-
return void 0;
|
|
2558
|
-
}
|
|
2559
|
-
__name(getValidRequestBody2, "getValidRequestBody");
|
|
2560
|
-
|
|
2561
|
-
// src/_api/generated/cfg_centrifugo/core/auth.gen.ts
|
|
2562
|
-
var getAuthToken2 = /* @__PURE__ */ __name(async (auth, callback) => {
|
|
2563
|
-
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
2564
|
-
if (!token) {
|
|
2565
|
-
return;
|
|
2566
|
-
}
|
|
2567
|
-
if (auth.scheme === "bearer") {
|
|
2568
|
-
return `Bearer ${token}`;
|
|
2569
|
-
}
|
|
2570
|
-
if (auth.scheme === "basic") {
|
|
2571
|
-
return `Basic ${btoa(token)}`;
|
|
2572
|
-
}
|
|
2573
|
-
return token;
|
|
2574
|
-
}, "getAuthToken");
|
|
2575
|
-
|
|
2576
|
-
// src/_api/generated/cfg_centrifugo/client/utils.gen.ts
|
|
2577
|
-
var createQuerySerializer2 = /* @__PURE__ */ __name(({
|
|
2578
|
-
parameters = {},
|
|
2579
|
-
...args
|
|
2580
|
-
} = {}) => {
|
|
2581
|
-
const querySerializer = /* @__PURE__ */ __name((queryParams) => {
|
|
2582
|
-
const search = [];
|
|
2583
|
-
if (queryParams && typeof queryParams === "object") {
|
|
2584
|
-
for (const name in queryParams) {
|
|
2585
|
-
const value = queryParams[name];
|
|
2586
|
-
if (value === void 0 || value === null) {
|
|
2587
|
-
continue;
|
|
2588
|
-
}
|
|
2589
|
-
const options = parameters[name] || args;
|
|
2590
|
-
if (Array.isArray(value)) {
|
|
2591
|
-
const serializedArray = serializeArrayParam2({
|
|
2592
|
-
allowReserved: options.allowReserved,
|
|
2593
|
-
explode: true,
|
|
2594
|
-
name,
|
|
2595
|
-
style: "form",
|
|
2596
|
-
value,
|
|
2597
|
-
...options.array
|
|
2598
|
-
});
|
|
2599
|
-
if (serializedArray) search.push(serializedArray);
|
|
2600
|
-
} else if (typeof value === "object") {
|
|
2601
|
-
const serializedObject = serializeObjectParam2({
|
|
2602
|
-
allowReserved: options.allowReserved,
|
|
2603
|
-
explode: true,
|
|
2604
|
-
name,
|
|
2605
|
-
style: "deepObject",
|
|
2606
|
-
value,
|
|
2607
|
-
...options.object
|
|
2608
|
-
});
|
|
2609
|
-
if (serializedObject) search.push(serializedObject);
|
|
2610
|
-
} else {
|
|
2611
|
-
const serializedPrimitive = serializePrimitiveParam2({
|
|
2612
|
-
allowReserved: options.allowReserved,
|
|
2613
|
-
name,
|
|
2614
|
-
value
|
|
2615
|
-
});
|
|
2616
|
-
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
2617
|
-
}
|
|
2618
|
-
}
|
|
2619
|
-
}
|
|
2620
|
-
return search.join("&");
|
|
2621
|
-
}, "querySerializer");
|
|
2622
|
-
return querySerializer;
|
|
2623
|
-
}, "createQuerySerializer");
|
|
2624
|
-
var getParseAs2 = /* @__PURE__ */ __name((contentType) => {
|
|
2625
|
-
if (!contentType) {
|
|
2626
|
-
return "stream";
|
|
2627
|
-
}
|
|
2628
|
-
const cleanContent = contentType.split(";")[0]?.trim();
|
|
2629
|
-
if (!cleanContent) {
|
|
2630
|
-
return;
|
|
2631
|
-
}
|
|
2632
|
-
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
|
2633
|
-
return "json";
|
|
2634
|
-
}
|
|
2635
|
-
if (cleanContent === "multipart/form-data") {
|
|
2636
|
-
return "formData";
|
|
2637
|
-
}
|
|
2638
|
-
if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
|
|
2639
|
-
return "blob";
|
|
2640
|
-
}
|
|
2641
|
-
if (cleanContent.startsWith("text/")) {
|
|
2642
|
-
return "text";
|
|
2643
|
-
}
|
|
2644
|
-
return;
|
|
2645
|
-
}, "getParseAs");
|
|
2646
|
-
var checkForExistence2 = /* @__PURE__ */ __name((options, name) => {
|
|
2647
|
-
if (!name) {
|
|
2648
|
-
return false;
|
|
2649
|
-
}
|
|
2650
|
-
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
2651
|
-
return true;
|
|
2652
|
-
}
|
|
2653
|
-
return false;
|
|
2654
|
-
}, "checkForExistence");
|
|
2655
|
-
var setAuthParams2 = /* @__PURE__ */ __name(async ({
|
|
2656
|
-
security,
|
|
2657
|
-
...options
|
|
2658
|
-
}) => {
|
|
2659
|
-
for (const auth of security) {
|
|
2660
|
-
if (checkForExistence2(options, auth.name)) {
|
|
2661
|
-
continue;
|
|
2662
|
-
}
|
|
2663
|
-
const token = await getAuthToken2(auth, options.auth);
|
|
2664
|
-
if (!token) {
|
|
2665
|
-
continue;
|
|
2666
|
-
}
|
|
2667
|
-
const name = auth.name ?? "Authorization";
|
|
2668
|
-
switch (auth.in) {
|
|
2669
|
-
case "query":
|
|
2670
|
-
if (!options.query) {
|
|
2671
|
-
options.query = {};
|
|
2672
|
-
}
|
|
2673
|
-
options.query[name] = token;
|
|
2674
|
-
break;
|
|
2675
|
-
case "cookie":
|
|
2676
|
-
options.headers.append("Cookie", `${name}=${token}`);
|
|
2677
|
-
break;
|
|
2678
|
-
case "header":
|
|
2679
|
-
default:
|
|
2680
|
-
options.headers.set(name, token);
|
|
2681
|
-
break;
|
|
2682
|
-
}
|
|
2683
|
-
}
|
|
2684
|
-
}, "setAuthParams");
|
|
2685
|
-
var buildUrl2 = /* @__PURE__ */ __name((options) => getUrl2({
|
|
2686
|
-
baseUrl: options.baseUrl,
|
|
2687
|
-
path: options.path,
|
|
2688
|
-
query: options.query,
|
|
2689
|
-
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer2(options.querySerializer),
|
|
2690
|
-
url: options.url
|
|
2691
|
-
}), "buildUrl");
|
|
2692
|
-
var mergeConfigs2 = /* @__PURE__ */ __name((a, b) => {
|
|
2693
|
-
const config = { ...a, ...b };
|
|
2694
|
-
if (config.baseUrl?.endsWith("/")) {
|
|
2695
|
-
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
2696
|
-
}
|
|
2697
|
-
config.headers = mergeHeaders2(a.headers, b.headers);
|
|
2698
|
-
return config;
|
|
2699
|
-
}, "mergeConfigs");
|
|
2700
|
-
var headersEntries2 = /* @__PURE__ */ __name((headers) => {
|
|
2701
|
-
const entries = [];
|
|
2702
|
-
headers.forEach((value, key) => {
|
|
2703
|
-
entries.push([key, value]);
|
|
2704
|
-
});
|
|
2705
|
-
return entries;
|
|
2706
|
-
}, "headersEntries");
|
|
2707
|
-
var mergeHeaders2 = /* @__PURE__ */ __name((...headers) => {
|
|
2708
|
-
const mergedHeaders = new Headers();
|
|
2709
|
-
for (const header of headers) {
|
|
2710
|
-
if (!header) {
|
|
2711
|
-
continue;
|
|
2712
|
-
}
|
|
2713
|
-
const iterator = header instanceof Headers ? headersEntries2(header) : Object.entries(header);
|
|
2714
|
-
for (const [key, value] of iterator) {
|
|
2715
|
-
if (value === null) {
|
|
2716
|
-
mergedHeaders.delete(key);
|
|
2717
|
-
} else if (Array.isArray(value)) {
|
|
2718
|
-
for (const v of value) {
|
|
2719
|
-
mergedHeaders.append(key, v);
|
|
2720
|
-
}
|
|
2721
|
-
} else if (value !== void 0) {
|
|
2722
|
-
mergedHeaders.set(
|
|
2723
|
-
key,
|
|
2724
|
-
typeof value === "object" ? JSON.stringify(value) : value
|
|
2725
|
-
);
|
|
2726
|
-
}
|
|
2727
|
-
}
|
|
2728
|
-
}
|
|
2729
|
-
return mergedHeaders;
|
|
2730
|
-
}, "mergeHeaders");
|
|
2731
|
-
var Interceptors2 = class {
|
|
2732
|
-
static {
|
|
2733
|
-
__name(this, "Interceptors");
|
|
2734
|
-
}
|
|
2735
|
-
fns = [];
|
|
2736
|
-
clear() {
|
|
2737
|
-
this.fns = [];
|
|
2738
|
-
}
|
|
2739
|
-
eject(id) {
|
|
2740
|
-
const index = this.getInterceptorIndex(id);
|
|
2741
|
-
if (this.fns[index]) {
|
|
2742
|
-
this.fns[index] = null;
|
|
2743
|
-
}
|
|
2744
|
-
}
|
|
2745
|
-
exists(id) {
|
|
2746
|
-
const index = this.getInterceptorIndex(id);
|
|
2747
|
-
return Boolean(this.fns[index]);
|
|
2748
|
-
}
|
|
2749
|
-
getInterceptorIndex(id) {
|
|
2750
|
-
if (typeof id === "number") {
|
|
2751
|
-
return this.fns[id] ? id : -1;
|
|
2752
|
-
}
|
|
2753
|
-
return this.fns.indexOf(id);
|
|
2754
|
-
}
|
|
2755
|
-
update(id, fn) {
|
|
2756
|
-
const index = this.getInterceptorIndex(id);
|
|
2757
|
-
if (this.fns[index]) {
|
|
2758
|
-
this.fns[index] = fn;
|
|
2759
|
-
return id;
|
|
2760
|
-
}
|
|
2761
|
-
return false;
|
|
2762
|
-
}
|
|
2763
|
-
use(fn) {
|
|
2764
|
-
this.fns.push(fn);
|
|
2765
|
-
return this.fns.length - 1;
|
|
2766
|
-
}
|
|
2767
|
-
};
|
|
2768
|
-
var createInterceptors2 = /* @__PURE__ */ __name(() => ({
|
|
2769
|
-
error: new Interceptors2(),
|
|
2770
|
-
request: new Interceptors2(),
|
|
2771
|
-
response: new Interceptors2()
|
|
2772
|
-
}), "createInterceptors");
|
|
2773
|
-
var defaultQuerySerializer2 = createQuerySerializer2({
|
|
2774
|
-
allowReserved: false,
|
|
2775
|
-
array: {
|
|
2776
|
-
explode: true,
|
|
2777
|
-
style: "form"
|
|
2778
|
-
},
|
|
2779
|
-
object: {
|
|
2780
|
-
explode: true,
|
|
2781
|
-
style: "deepObject"
|
|
2782
|
-
}
|
|
2783
|
-
});
|
|
2784
|
-
var defaultHeaders2 = {
|
|
2785
|
-
"Content-Type": "application/json"
|
|
2786
|
-
};
|
|
2787
|
-
var createConfig2 = /* @__PURE__ */ __name((override = {}) => ({
|
|
2788
|
-
...jsonBodySerializer2,
|
|
2789
|
-
headers: defaultHeaders2,
|
|
2790
|
-
parseAs: "auto",
|
|
2791
|
-
querySerializer: defaultQuerySerializer2,
|
|
2792
|
-
...override
|
|
2793
|
-
}), "createConfig");
|
|
2794
|
-
|
|
2795
|
-
// src/_api/generated/cfg_centrifugo/client/client.gen.ts
|
|
2796
|
-
var createClient2 = /* @__PURE__ */ __name((config = {}) => {
|
|
2797
|
-
let _config = mergeConfigs2(createConfig2(), config);
|
|
2798
|
-
const getConfig = /* @__PURE__ */ __name(() => ({ ..._config }), "getConfig");
|
|
2799
|
-
const setConfig = /* @__PURE__ */ __name((config2) => {
|
|
2800
|
-
_config = mergeConfigs2(_config, config2);
|
|
2801
|
-
return getConfig();
|
|
2802
|
-
}, "setConfig");
|
|
2803
|
-
const interceptors = createInterceptors2();
|
|
2804
|
-
const beforeRequest = /* @__PURE__ */ __name(async (options) => {
|
|
2805
|
-
const opts = {
|
|
2806
|
-
..._config,
|
|
2807
|
-
...options,
|
|
2808
|
-
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
2809
|
-
headers: mergeHeaders2(_config.headers, options.headers),
|
|
2810
|
-
serializedBody: void 0
|
|
2811
|
-
};
|
|
2812
|
-
if (opts.security) {
|
|
2813
|
-
await setAuthParams2({
|
|
2814
|
-
...opts,
|
|
2815
|
-
security: opts.security
|
|
2816
|
-
});
|
|
2817
|
-
}
|
|
2818
|
-
if (opts.requestValidator) {
|
|
2819
|
-
await opts.requestValidator(opts);
|
|
2820
|
-
}
|
|
2821
|
-
if (opts.body !== void 0 && opts.bodySerializer) {
|
|
2822
|
-
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
2823
|
-
}
|
|
2824
|
-
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
2825
|
-
opts.headers.delete("Content-Type");
|
|
2826
|
-
}
|
|
2827
|
-
const resolvedOpts = opts;
|
|
2828
|
-
const url = buildUrl2(resolvedOpts);
|
|
2829
|
-
return { opts: resolvedOpts, url };
|
|
2830
|
-
}, "beforeRequest");
|
|
2831
|
-
const request = /* @__PURE__ */ __name(async (options) => {
|
|
2832
|
-
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
2833
|
-
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
2834
|
-
let request2;
|
|
2835
|
-
let response;
|
|
2836
|
-
try {
|
|
2837
|
-
const { opts, url } = await beforeRequest(options);
|
|
2838
|
-
const requestInit = {
|
|
2839
|
-
redirect: "follow",
|
|
2840
|
-
...opts,
|
|
2841
|
-
body: getValidRequestBody2(opts)
|
|
2842
|
-
};
|
|
2843
|
-
request2 = new Request(url, requestInit);
|
|
2844
|
-
for (const fn of interceptors.request.fns) {
|
|
2845
|
-
if (fn) {
|
|
2846
|
-
request2 = await fn(request2, opts);
|
|
2847
|
-
}
|
|
2848
|
-
}
|
|
2849
|
-
const _fetch = opts.fetch;
|
|
2850
|
-
response = await _fetch(request2);
|
|
2851
|
-
for (const fn of interceptors.response.fns) {
|
|
2852
|
-
if (fn) {
|
|
2853
|
-
response = await fn(response, request2, opts);
|
|
2854
|
-
}
|
|
2855
|
-
}
|
|
2856
|
-
const result = {
|
|
2857
|
-
request: request2,
|
|
2858
|
-
response
|
|
2859
|
-
};
|
|
2860
|
-
if (response.ok) {
|
|
2861
|
-
const parseAs = (opts.parseAs === "auto" ? getParseAs2(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
2862
|
-
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
2863
|
-
let emptyData;
|
|
2864
|
-
switch (parseAs) {
|
|
2865
|
-
case "arrayBuffer":
|
|
2866
|
-
case "blob":
|
|
2867
|
-
case "text":
|
|
2868
|
-
emptyData = await response[parseAs]();
|
|
2869
|
-
break;
|
|
2870
|
-
case "formData":
|
|
2871
|
-
emptyData = new FormData();
|
|
2872
|
-
break;
|
|
2873
|
-
case "stream":
|
|
2874
|
-
emptyData = response.body;
|
|
2875
|
-
break;
|
|
2876
|
-
case "json":
|
|
2877
|
-
default:
|
|
2878
|
-
emptyData = {};
|
|
2879
|
-
break;
|
|
2880
|
-
}
|
|
2881
|
-
return opts.responseStyle === "data" ? emptyData : {
|
|
2882
|
-
data: emptyData,
|
|
2883
|
-
...result
|
|
2884
|
-
};
|
|
2885
|
-
}
|
|
2886
|
-
let data;
|
|
2887
|
-
switch (parseAs) {
|
|
2888
|
-
case "arrayBuffer":
|
|
2889
|
-
case "blob":
|
|
2890
|
-
case "formData":
|
|
2891
|
-
case "text":
|
|
2892
|
-
data = await response[parseAs]();
|
|
2893
|
-
break;
|
|
2894
|
-
case "json": {
|
|
2895
|
-
const text = await response.text();
|
|
2896
|
-
data = text ? JSON.parse(text) : {};
|
|
2897
|
-
break;
|
|
2898
|
-
}
|
|
2899
|
-
case "stream":
|
|
2900
|
-
return opts.responseStyle === "data" ? response.body : {
|
|
2901
|
-
data: response.body,
|
|
2902
|
-
...result
|
|
2903
|
-
};
|
|
2904
|
-
}
|
|
2905
|
-
if (parseAs === "json") {
|
|
2906
|
-
if (opts.responseValidator) {
|
|
2907
|
-
await opts.responseValidator(data);
|
|
2908
|
-
}
|
|
2909
|
-
if (opts.responseTransformer) {
|
|
2910
|
-
data = await opts.responseTransformer(data);
|
|
2911
|
-
}
|
|
2912
|
-
}
|
|
2913
|
-
return opts.responseStyle === "data" ? data : {
|
|
2914
|
-
data,
|
|
2915
|
-
...result
|
|
2916
|
-
};
|
|
2917
|
-
}
|
|
2918
|
-
const textError = await response.text();
|
|
2919
|
-
let jsonError;
|
|
2920
|
-
try {
|
|
2921
|
-
jsonError = JSON.parse(textError);
|
|
2922
|
-
} catch {
|
|
2923
|
-
}
|
|
2924
|
-
throw jsonError ?? textError;
|
|
2925
|
-
} catch (error) {
|
|
2926
|
-
let finalError = error;
|
|
2927
|
-
for (const fn of interceptors.error.fns) {
|
|
2928
|
-
if (fn) {
|
|
2929
|
-
finalError = await fn(finalError, response, request2, options);
|
|
2930
|
-
}
|
|
2931
|
-
}
|
|
2932
|
-
finalError = finalError || {};
|
|
2933
|
-
if (throwOnError) {
|
|
2934
|
-
throw finalError;
|
|
2935
|
-
}
|
|
2936
|
-
return responseStyle === "data" ? void 0 : {
|
|
2937
|
-
error: finalError,
|
|
2938
|
-
request: request2,
|
|
2939
|
-
response
|
|
2940
|
-
};
|
|
2941
|
-
}
|
|
2942
|
-
}, "request");
|
|
2943
|
-
const makeMethodFn = /* @__PURE__ */ __name((method) => (options) => request({ ...options, method }), "makeMethodFn");
|
|
2944
|
-
const makeSseFn = /* @__PURE__ */ __name((method) => async (options) => {
|
|
2945
|
-
const { opts, url } = await beforeRequest(options);
|
|
2946
|
-
return createSseClient2({
|
|
2947
|
-
...opts,
|
|
2948
|
-
body: opts.body,
|
|
2949
|
-
method,
|
|
2950
|
-
onRequest: /* @__PURE__ */ __name(async (url2, init) => {
|
|
2951
|
-
let request2 = new Request(url2, init);
|
|
2952
|
-
for (const fn of interceptors.request.fns) {
|
|
2953
|
-
if (fn) {
|
|
2954
|
-
request2 = await fn(request2, opts);
|
|
2955
|
-
}
|
|
2956
|
-
}
|
|
2957
|
-
return request2;
|
|
2958
|
-
}, "onRequest"),
|
|
2959
|
-
serializedBody: getValidRequestBody2(opts),
|
|
2960
|
-
url
|
|
2961
|
-
});
|
|
2962
|
-
}, "makeSseFn");
|
|
2963
|
-
const _buildUrl = /* @__PURE__ */ __name((options) => buildUrl2({ ..._config, ...options }), "_buildUrl");
|
|
2964
|
-
return {
|
|
2965
|
-
buildUrl: _buildUrl,
|
|
2966
|
-
connect: makeMethodFn("CONNECT"),
|
|
2967
|
-
delete: makeMethodFn("DELETE"),
|
|
2968
|
-
get: makeMethodFn("GET"),
|
|
2969
|
-
getConfig,
|
|
2970
|
-
head: makeMethodFn("HEAD"),
|
|
2971
|
-
interceptors,
|
|
2972
|
-
options: makeMethodFn("OPTIONS"),
|
|
2973
|
-
patch: makeMethodFn("PATCH"),
|
|
2974
|
-
post: makeMethodFn("POST"),
|
|
2975
|
-
put: makeMethodFn("PUT"),
|
|
2976
|
-
request,
|
|
2977
|
-
setConfig,
|
|
2978
|
-
sse: {
|
|
2979
|
-
connect: makeSseFn("CONNECT"),
|
|
2980
|
-
delete: makeSseFn("DELETE"),
|
|
2981
|
-
get: makeSseFn("GET"),
|
|
2982
|
-
head: makeSseFn("HEAD"),
|
|
2983
|
-
options: makeSseFn("OPTIONS"),
|
|
2984
|
-
patch: makeSseFn("PATCH"),
|
|
2985
|
-
post: makeSseFn("POST"),
|
|
2986
|
-
put: makeSseFn("PUT"),
|
|
2987
|
-
trace: makeSseFn("TRACE")
|
|
2988
|
-
},
|
|
2989
|
-
trace: makeMethodFn("TRACE")
|
|
2990
|
-
};
|
|
2991
|
-
}, "createClient");
|
|
2992
|
-
|
|
2993
|
-
// src/_api/generated/cfg_centrifugo/client.gen.ts
|
|
2994
|
-
var client2 = createClient2(createConfig2({ baseUrl: "http://localhost:8000" }));
|
|
2995
|
-
|
|
2996
|
-
// src/_api/generated/cfg_centrifugo/sdk.gen.ts
|
|
2997
|
-
var Cfg2 = class {
|
|
2998
|
-
static {
|
|
2999
|
-
__name(this, "Cfg");
|
|
3000
|
-
}
|
|
3001
|
-
/**
|
|
3002
|
-
* Get Centrifugo connection token
|
|
3003
|
-
*
|
|
3004
|
-
* Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
|
|
3005
|
-
*/
|
|
3006
|
-
static cfgCentrifugoAuthTokenRetrieve(options) {
|
|
3007
|
-
return (options?.client ?? client2).get({
|
|
3008
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
3009
|
-
url: "/cfg/centrifugo/auth/token/",
|
|
3010
|
-
...options
|
|
3011
|
-
});
|
|
3012
|
-
}
|
|
3013
|
-
};
|
|
3014
|
-
var Centrifugo = class {
|
|
3015
|
-
static {
|
|
3016
|
-
__name(this, "Centrifugo");
|
|
3017
|
-
}
|
|
3018
|
-
/**
|
|
3019
|
-
* Get Centrifugo connection token
|
|
3020
|
-
*
|
|
3021
|
-
* Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
|
|
3022
|
-
*/
|
|
3023
|
-
static cfgCentrifugoAuthTokenRetrieve(options) {
|
|
3024
|
-
return (options?.client ?? client2).get({
|
|
3025
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
3026
|
-
url: "/cfg/centrifugo/auth/token/",
|
|
3027
|
-
...options
|
|
3028
|
-
});
|
|
3029
|
-
}
|
|
3030
|
-
};
|
|
3031
|
-
var CentrifugoAuth = class {
|
|
3032
|
-
static {
|
|
3033
|
-
__name(this, "CentrifugoAuth");
|
|
3034
|
-
}
|
|
3035
|
-
/**
|
|
3036
|
-
* Get Centrifugo connection token
|
|
3037
|
-
*
|
|
3038
|
-
* Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
|
|
3039
|
-
*/
|
|
3040
|
-
static cfgCentrifugoAuthTokenRetrieve(options) {
|
|
3041
|
-
return (options?.client ?? client2).get({
|
|
3042
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
3043
|
-
url: "/cfg/centrifugo/auth/token/",
|
|
3044
|
-
...options
|
|
3045
|
-
});
|
|
3046
|
-
}
|
|
3047
|
-
};
|
|
3048
|
-
|
|
3049
|
-
// src/_api/generated/cfg_centrifugo/schemas/ConnectionTokenResponse.ts
|
|
3050
|
-
import { z as z22 } from "zod";
|
|
3051
|
-
var ConnectionTokenResponseSchema = z22.object({
|
|
3052
|
-
token: z22.string(),
|
|
3053
|
-
centrifugo_url: z22.string(),
|
|
3054
|
-
expires_at: z22.string(),
|
|
3055
|
-
channels: z22.array(z22.string())
|
|
3056
|
-
});
|
|
3057
|
-
|
|
3058
|
-
// src/_api/generated/cfg_centrifugo/api.ts
|
|
3059
|
-
var ACCESS_KEY2 = "cfg.access_token";
|
|
3060
|
-
var REFRESH_KEY2 = "cfg.refresh_token";
|
|
3061
|
-
var VALIDATION_ROUTES2 = [
|
|
3062
|
-
{ method: "GET", re: new RegExp("^/cfg/centrifugo/auth/token/?$"), schema: ConnectionTokenResponseSchema, path: "/cfg/centrifugo/auth/token/" }
|
|
3063
|
-
];
|
|
3064
|
-
function detectLocale2() {
|
|
3065
|
-
try {
|
|
3066
|
-
if (typeof document !== "undefined") {
|
|
3067
|
-
const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
3068
|
-
if (m) return decodeURIComponent(m[1]);
|
|
3069
|
-
}
|
|
3070
|
-
if (typeof navigator !== "undefined" && navigator.language) {
|
|
3071
|
-
return navigator.language;
|
|
3072
|
-
}
|
|
3073
|
-
} catch {
|
|
3074
|
-
}
|
|
3075
|
-
return null;
|
|
3076
|
-
}
|
|
3077
|
-
__name(detectLocale2, "detectLocale");
|
|
3078
|
-
var API2 = class {
|
|
3079
|
-
static {
|
|
3080
|
-
__name(this, "API");
|
|
3081
|
-
}
|
|
3082
|
-
baseUrl;
|
|
3083
|
-
storage;
|
|
3084
|
-
locale;
|
|
3085
|
-
apiKey;
|
|
3086
|
-
logger;
|
|
3087
|
-
cfg = Cfg2;
|
|
3088
|
-
centrifugo = Centrifugo;
|
|
3089
|
-
centrifugoAuth = CentrifugoAuth;
|
|
3090
|
-
constructor(baseUrl2, opts = {}) {
|
|
3091
|
-
this.baseUrl = baseUrl2.replace(/\/$/, "");
|
|
3092
|
-
this.storage = opts.storage ?? new LocalStorageAdapter();
|
|
3093
|
-
this.logger = new APILogger(opts.logger);
|
|
3094
|
-
this.locale = opts.locale ?? null;
|
|
3095
|
-
this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
|
|
3096
|
-
const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
|
|
3097
|
-
client2.setConfig({ baseUrl: this.baseUrl, credentials });
|
|
3098
|
-
client2.interceptors.request.use((request) => {
|
|
3099
|
-
const access = this.getToken();
|
|
3100
|
-
if (access) request.headers.set("Authorization", `Bearer ${access}`);
|
|
3101
|
-
const locale = this.locale ?? detectLocale2();
|
|
3102
|
-
if (locale) request.headers.set("Accept-Language", locale);
|
|
3103
|
-
if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
|
|
3104
|
-
return request;
|
|
3105
|
-
});
|
|
3106
|
-
client2.interceptors.response.use(async (response, request) => {
|
|
3107
|
-
if (!response.ok) return response;
|
|
3108
|
-
const ct = response.headers.get("content-type") || "";
|
|
3109
|
-
if (!ct.includes("application/json")) return response;
|
|
3110
|
-
const url = new URL(request.url);
|
|
3111
|
-
const method = request.method.toUpperCase();
|
|
3112
|
-
const route = VALIDATION_ROUTES2.find(
|
|
3113
|
-
(r) => r.method === method && r.re.test(url.pathname)
|
|
3114
|
-
);
|
|
3115
|
-
if (!route) return response;
|
|
3116
|
-
let payload;
|
|
3117
|
-
try {
|
|
3118
|
-
payload = await response.clone().json();
|
|
3119
|
-
} catch {
|
|
3120
|
-
return response;
|
|
3121
|
-
}
|
|
3122
|
-
const result = route.schema.safeParse(payload);
|
|
3123
|
-
if (!result.success) {
|
|
3124
|
-
dispatchValidationError({
|
|
3125
|
-
operation: `${method} ${route.path}`,
|
|
3126
|
-
path: route.path,
|
|
3127
|
-
method,
|
|
3128
|
-
error: result.error,
|
|
3129
|
-
response: payload,
|
|
3130
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
3131
|
-
});
|
|
3132
|
-
}
|
|
3133
|
-
return response;
|
|
3134
|
-
});
|
|
3135
|
-
}
|
|
3136
|
-
// ── Base URL ────────────────────────────────────────────────────────────
|
|
3137
|
-
getBaseUrl() {
|
|
3138
|
-
return this.baseUrl;
|
|
3139
|
-
}
|
|
3140
|
-
setBaseUrl(url) {
|
|
3141
|
-
this.baseUrl = url.replace(/\/$/, "");
|
|
3142
|
-
client2.setConfig({ baseUrl: this.baseUrl });
|
|
3143
|
-
}
|
|
3144
|
-
// ── Tokens ──────────────────────────────────────────────────────────────
|
|
3145
|
-
getToken() {
|
|
3146
|
-
return this.storage.getItem(ACCESS_KEY2);
|
|
3147
|
-
}
|
|
3148
|
-
setToken(token) {
|
|
3149
|
-
if (token) this.storage.setItem(ACCESS_KEY2, token);
|
|
3150
|
-
else this.storage.removeItem(ACCESS_KEY2);
|
|
3151
|
-
}
|
|
3152
|
-
getRefreshToken() {
|
|
3153
|
-
return this.storage.getItem(REFRESH_KEY2);
|
|
3154
|
-
}
|
|
3155
|
-
setRefreshToken(token) {
|
|
3156
|
-
if (token) this.storage.setItem(REFRESH_KEY2, token);
|
|
3157
|
-
else this.storage.removeItem(REFRESH_KEY2);
|
|
3158
|
-
}
|
|
3159
|
-
clearToken() {
|
|
3160
|
-
this.storage.removeItem(ACCESS_KEY2);
|
|
3161
|
-
this.storage.removeItem(REFRESH_KEY2);
|
|
3162
|
-
}
|
|
3163
|
-
isAuthenticated() {
|
|
3164
|
-
return this.getToken() !== null;
|
|
3165
|
-
}
|
|
3166
|
-
// ── Locale / API key ────────────────────────────────────────────────────
|
|
3167
|
-
getLocale() {
|
|
3168
|
-
return this.locale ?? detectLocale2();
|
|
3169
|
-
}
|
|
3170
|
-
setLocale(locale) {
|
|
3171
|
-
this.locale = locale;
|
|
3172
|
-
}
|
|
3173
|
-
getApiKey() {
|
|
3174
|
-
return this.apiKey;
|
|
3175
|
-
}
|
|
3176
|
-
setApiKey(key) {
|
|
3177
|
-
this.apiKey = key;
|
|
3178
|
-
}
|
|
3179
|
-
};
|
|
3180
|
-
|
|
3181
|
-
// src/_api/generated/cfg_totp/core/bodySerializer.gen.ts
|
|
3182
|
-
var jsonBodySerializer3 = {
|
|
3183
|
-
bodySerializer: /* @__PURE__ */ __name((body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value), "bodySerializer")
|
|
3184
|
-
};
|
|
3185
|
-
|
|
3186
|
-
// src/_api/generated/cfg_totp/core/params.gen.ts
|
|
3187
|
-
var extraPrefixesMap3 = {
|
|
3188
|
-
$body_: "body",
|
|
3189
|
-
$headers_: "headers",
|
|
3190
|
-
$path_: "path",
|
|
3191
|
-
$query_: "query"
|
|
3192
|
-
};
|
|
3193
|
-
var extraPrefixes3 = Object.entries(extraPrefixesMap3);
|
|
3194
|
-
|
|
3195
|
-
// src/_api/generated/cfg_totp/core/serverSentEvents.gen.ts
|
|
3196
|
-
function createSseClient3({
|
|
3197
|
-
onRequest,
|
|
3198
|
-
onSseError,
|
|
3199
|
-
onSseEvent,
|
|
3200
|
-
responseTransformer,
|
|
3201
|
-
responseValidator,
|
|
3202
|
-
sseDefaultRetryDelay,
|
|
3203
|
-
sseMaxRetryAttempts,
|
|
3204
|
-
sseMaxRetryDelay,
|
|
3205
|
-
sseSleepFn,
|
|
3206
|
-
url,
|
|
3207
|
-
...options
|
|
3208
|
-
}) {
|
|
3209
|
-
let lastEventId;
|
|
3210
|
-
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
3211
|
-
const createStream = /* @__PURE__ */ __name(async function* () {
|
|
3212
|
-
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
3213
|
-
let attempt = 0;
|
|
3214
|
-
const signal = options.signal ?? new AbortController().signal;
|
|
3215
|
-
while (true) {
|
|
3216
|
-
if (signal.aborted) break;
|
|
3217
|
-
attempt++;
|
|
3218
|
-
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
3219
|
-
if (lastEventId !== void 0) {
|
|
3220
|
-
headers.set("Last-Event-ID", lastEventId);
|
|
3221
|
-
}
|
|
3222
|
-
try {
|
|
3223
|
-
const requestInit = {
|
|
3224
|
-
redirect: "follow",
|
|
3225
|
-
...options,
|
|
3226
|
-
body: options.serializedBody,
|
|
3227
|
-
headers,
|
|
3228
|
-
signal
|
|
3229
|
-
};
|
|
3230
|
-
let request = new Request(url, requestInit);
|
|
3231
|
-
if (onRequest) {
|
|
3232
|
-
request = await onRequest(url, requestInit);
|
|
3233
|
-
}
|
|
3234
|
-
const _fetch = options.fetch ?? globalThis.fetch;
|
|
3235
|
-
const response = await _fetch(request);
|
|
3236
|
-
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
3237
|
-
if (!response.body) throw new Error("No body in SSE response");
|
|
3238
|
-
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
3239
|
-
let buffer = "";
|
|
3240
|
-
const abortHandler = /* @__PURE__ */ __name(() => {
|
|
3241
|
-
try {
|
|
3242
|
-
reader.cancel();
|
|
3243
|
-
} catch {
|
|
3244
|
-
}
|
|
3245
|
-
}, "abortHandler");
|
|
3246
|
-
signal.addEventListener("abort", abortHandler);
|
|
3247
|
-
try {
|
|
3248
|
-
while (true) {
|
|
3249
|
-
const { done, value } = await reader.read();
|
|
3250
|
-
if (done) break;
|
|
3251
|
-
buffer += value;
|
|
3252
|
-
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
3253
|
-
const chunks = buffer.split("\n\n");
|
|
3254
|
-
buffer = chunks.pop() ?? "";
|
|
3255
|
-
for (const chunk of chunks) {
|
|
3256
|
-
const lines = chunk.split("\n");
|
|
3257
|
-
const dataLines = [];
|
|
3258
|
-
let eventName;
|
|
3259
|
-
for (const line of lines) {
|
|
3260
|
-
if (line.startsWith("data:")) {
|
|
3261
|
-
dataLines.push(line.replace(/^data:\s*/, ""));
|
|
3262
|
-
} else if (line.startsWith("event:")) {
|
|
3263
|
-
eventName = line.replace(/^event:\s*/, "");
|
|
3264
|
-
} else if (line.startsWith("id:")) {
|
|
3265
|
-
lastEventId = line.replace(/^id:\s*/, "");
|
|
3266
|
-
} else if (line.startsWith("retry:")) {
|
|
3267
|
-
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
|
3268
|
-
if (!Number.isNaN(parsed)) {
|
|
3269
|
-
retryDelay = parsed;
|
|
3270
|
-
}
|
|
3271
|
-
}
|
|
3272
|
-
}
|
|
3273
|
-
let data;
|
|
3274
|
-
let parsedJson = false;
|
|
3275
|
-
if (dataLines.length) {
|
|
3276
|
-
const rawData = dataLines.join("\n");
|
|
3277
|
-
try {
|
|
3278
|
-
data = JSON.parse(rawData);
|
|
3279
|
-
parsedJson = true;
|
|
3280
|
-
} catch {
|
|
3281
|
-
data = rawData;
|
|
3282
|
-
}
|
|
3283
|
-
}
|
|
3284
|
-
if (parsedJson) {
|
|
3285
|
-
if (responseValidator) {
|
|
3286
|
-
await responseValidator(data);
|
|
3287
|
-
}
|
|
3288
|
-
if (responseTransformer) {
|
|
3289
|
-
data = await responseTransformer(data);
|
|
3290
|
-
}
|
|
3291
|
-
}
|
|
3292
|
-
onSseEvent?.({
|
|
3293
|
-
data,
|
|
3294
|
-
event: eventName,
|
|
3295
|
-
id: lastEventId,
|
|
3296
|
-
retry: retryDelay
|
|
3297
|
-
});
|
|
3298
|
-
if (dataLines.length) {
|
|
3299
|
-
yield data;
|
|
3300
|
-
}
|
|
3301
|
-
}
|
|
3302
|
-
}
|
|
3303
|
-
} finally {
|
|
3304
|
-
signal.removeEventListener("abort", abortHandler);
|
|
3305
|
-
reader.releaseLock();
|
|
3306
|
-
}
|
|
3307
|
-
break;
|
|
3308
|
-
} catch (error) {
|
|
3309
|
-
onSseError?.(error);
|
|
3310
|
-
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
|
|
3311
|
-
break;
|
|
3312
|
-
}
|
|
3313
|
-
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
|
|
3314
|
-
await sleep(backoff);
|
|
3315
|
-
}
|
|
3316
|
-
}
|
|
3317
|
-
}, "createStream");
|
|
3318
|
-
const stream = createStream();
|
|
3319
|
-
return { stream };
|
|
3320
|
-
}
|
|
3321
|
-
__name(createSseClient3, "createSseClient");
|
|
3322
|
-
|
|
3323
|
-
// src/_api/generated/cfg_totp/core/pathSerializer.gen.ts
|
|
3324
|
-
var separatorArrayExplode3 = /* @__PURE__ */ __name((style) => {
|
|
3325
|
-
switch (style) {
|
|
3326
|
-
case "label":
|
|
3327
|
-
return ".";
|
|
3328
|
-
case "matrix":
|
|
3329
|
-
return ";";
|
|
3330
|
-
case "simple":
|
|
3331
|
-
return ",";
|
|
3332
|
-
default:
|
|
3333
|
-
return "&";
|
|
3334
|
-
}
|
|
3335
|
-
}, "separatorArrayExplode");
|
|
3336
|
-
var separatorArrayNoExplode3 = /* @__PURE__ */ __name((style) => {
|
|
3337
|
-
switch (style) {
|
|
3338
|
-
case "form":
|
|
3339
|
-
return ",";
|
|
3340
|
-
case "pipeDelimited":
|
|
3341
|
-
return "|";
|
|
3342
|
-
case "spaceDelimited":
|
|
3343
|
-
return "%20";
|
|
3344
|
-
default:
|
|
3345
|
-
return ",";
|
|
3346
|
-
}
|
|
3347
|
-
}, "separatorArrayNoExplode");
|
|
3348
|
-
var separatorObjectExplode3 = /* @__PURE__ */ __name((style) => {
|
|
3349
|
-
switch (style) {
|
|
3350
|
-
case "label":
|
|
3351
|
-
return ".";
|
|
3352
|
-
case "matrix":
|
|
3353
|
-
return ";";
|
|
3354
|
-
case "simple":
|
|
3355
|
-
return ",";
|
|
3356
|
-
default:
|
|
3357
|
-
return "&";
|
|
3358
|
-
}
|
|
3359
|
-
}, "separatorObjectExplode");
|
|
3360
|
-
var serializeArrayParam3 = /* @__PURE__ */ __name(({
|
|
3361
|
-
allowReserved,
|
|
3362
|
-
explode,
|
|
3363
|
-
name,
|
|
3364
|
-
style,
|
|
3365
|
-
value
|
|
3366
|
-
}) => {
|
|
3367
|
-
if (!explode) {
|
|
3368
|
-
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode3(style));
|
|
3369
|
-
switch (style) {
|
|
3370
|
-
case "label":
|
|
3371
|
-
return `.${joinedValues2}`;
|
|
3372
|
-
case "matrix":
|
|
3373
|
-
return `;${name}=${joinedValues2}`;
|
|
3374
|
-
case "simple":
|
|
3375
|
-
return joinedValues2;
|
|
3376
|
-
default:
|
|
3377
|
-
return `${name}=${joinedValues2}`;
|
|
3378
|
-
}
|
|
3379
|
-
}
|
|
3380
|
-
const separator = separatorArrayExplode3(style);
|
|
3381
|
-
const joinedValues = value.map((v) => {
|
|
3382
|
-
if (style === "label" || style === "simple") {
|
|
3383
|
-
return allowReserved ? v : encodeURIComponent(v);
|
|
3384
|
-
}
|
|
3385
|
-
return serializePrimitiveParam3({
|
|
3386
|
-
allowReserved,
|
|
3387
|
-
name,
|
|
3388
|
-
value: v
|
|
3389
|
-
});
|
|
3390
|
-
}).join(separator);
|
|
3391
|
-
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
3392
|
-
}, "serializeArrayParam");
|
|
3393
|
-
var serializePrimitiveParam3 = /* @__PURE__ */ __name(({
|
|
3394
|
-
allowReserved,
|
|
3395
|
-
name,
|
|
3396
|
-
value
|
|
3397
|
-
}) => {
|
|
3398
|
-
if (value === void 0 || value === null) {
|
|
3399
|
-
return "";
|
|
3400
|
-
}
|
|
3401
|
-
if (typeof value === "object") {
|
|
3402
|
-
throw new Error(
|
|
3403
|
-
"Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
|
|
3404
|
-
);
|
|
3405
|
-
}
|
|
3406
|
-
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
3407
|
-
}, "serializePrimitiveParam");
|
|
3408
|
-
var serializeObjectParam3 = /* @__PURE__ */ __name(({
|
|
3409
|
-
allowReserved,
|
|
3410
|
-
explode,
|
|
3411
|
-
name,
|
|
3412
|
-
style,
|
|
3413
|
-
value,
|
|
3414
|
-
valueOnly
|
|
3415
|
-
}) => {
|
|
3416
|
-
if (value instanceof Date) {
|
|
3417
|
-
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
3418
|
-
}
|
|
3419
|
-
if (style !== "deepObject" && !explode) {
|
|
3420
|
-
let values = [];
|
|
3421
|
-
Object.entries(value).forEach(([key, v]) => {
|
|
3422
|
-
values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
|
|
3423
|
-
});
|
|
3424
|
-
const joinedValues2 = values.join(",");
|
|
3425
|
-
switch (style) {
|
|
3426
|
-
case "form":
|
|
3427
|
-
return `${name}=${joinedValues2}`;
|
|
3428
|
-
case "label":
|
|
3429
|
-
return `.${joinedValues2}`;
|
|
3430
|
-
case "matrix":
|
|
3431
|
-
return `;${name}=${joinedValues2}`;
|
|
3432
|
-
default:
|
|
3433
|
-
return joinedValues2;
|
|
3434
|
-
}
|
|
3435
|
-
}
|
|
3436
|
-
const separator = separatorObjectExplode3(style);
|
|
3437
|
-
const joinedValues = Object.entries(value).map(
|
|
3438
|
-
([key, v]) => serializePrimitiveParam3({
|
|
3439
|
-
allowReserved,
|
|
3440
|
-
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
3441
|
-
value: v
|
|
3442
|
-
})
|
|
3443
|
-
).join(separator);
|
|
3444
|
-
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
3445
|
-
}, "serializeObjectParam");
|
|
3446
|
-
|
|
3447
|
-
// src/_api/generated/cfg_totp/core/utils.gen.ts
|
|
3448
|
-
var PATH_PARAM_RE3 = /\{[^{}]+\}/g;
|
|
3449
|
-
var defaultPathSerializer3 = /* @__PURE__ */ __name(({ path, url: _url }) => {
|
|
3450
|
-
let url = _url;
|
|
3451
|
-
const matches = _url.match(PATH_PARAM_RE3);
|
|
3452
|
-
if (matches) {
|
|
3453
|
-
for (const match of matches) {
|
|
3454
|
-
let explode = false;
|
|
3455
|
-
let name = match.substring(1, match.length - 1);
|
|
3456
|
-
let style = "simple";
|
|
3457
|
-
if (name.endsWith("*")) {
|
|
3458
|
-
explode = true;
|
|
3459
|
-
name = name.substring(0, name.length - 1);
|
|
3460
|
-
}
|
|
3461
|
-
if (name.startsWith(".")) {
|
|
3462
|
-
name = name.substring(1);
|
|
3463
|
-
style = "label";
|
|
3464
|
-
} else if (name.startsWith(";")) {
|
|
3465
|
-
name = name.substring(1);
|
|
3466
|
-
style = "matrix";
|
|
3467
|
-
}
|
|
3468
|
-
const value = path[name];
|
|
3469
|
-
if (value === void 0 || value === null) {
|
|
3470
|
-
continue;
|
|
3471
|
-
}
|
|
3472
|
-
if (Array.isArray(value)) {
|
|
3473
|
-
url = url.replace(match, serializeArrayParam3({ explode, name, style, value }));
|
|
3474
|
-
continue;
|
|
3475
|
-
}
|
|
3476
|
-
if (typeof value === "object") {
|
|
3477
|
-
url = url.replace(
|
|
3478
|
-
match,
|
|
3479
|
-
serializeObjectParam3({
|
|
3480
|
-
explode,
|
|
3481
|
-
name,
|
|
3482
|
-
style,
|
|
3483
|
-
value,
|
|
3484
|
-
valueOnly: true
|
|
3485
|
-
})
|
|
3486
|
-
);
|
|
3487
|
-
continue;
|
|
3488
|
-
}
|
|
3489
|
-
if (style === "matrix") {
|
|
3490
|
-
url = url.replace(
|
|
3491
|
-
match,
|
|
3492
|
-
`;${serializePrimitiveParam3({
|
|
3493
|
-
name,
|
|
3494
|
-
value
|
|
3495
|
-
})}`
|
|
3496
|
-
);
|
|
3497
|
-
continue;
|
|
3498
|
-
}
|
|
3499
|
-
const replaceValue = encodeURIComponent(
|
|
3500
|
-
style === "label" ? `.${value}` : value
|
|
3501
|
-
);
|
|
3502
|
-
url = url.replace(match, replaceValue);
|
|
3503
|
-
}
|
|
3504
|
-
}
|
|
3505
|
-
return url;
|
|
3506
|
-
}, "defaultPathSerializer");
|
|
3507
|
-
var getUrl3 = /* @__PURE__ */ __name(({
|
|
3508
|
-
baseUrl: baseUrl2,
|
|
3509
|
-
path,
|
|
3510
|
-
query,
|
|
3511
|
-
querySerializer,
|
|
3512
|
-
url: _url
|
|
3513
|
-
}) => {
|
|
3514
|
-
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
3515
|
-
let url = (baseUrl2 ?? "") + pathUrl;
|
|
3516
|
-
if (path) {
|
|
3517
|
-
url = defaultPathSerializer3({ path, url });
|
|
3518
|
-
}
|
|
3519
|
-
let search = query ? querySerializer(query) : "";
|
|
3520
|
-
if (search.startsWith("?")) {
|
|
3521
|
-
search = search.substring(1);
|
|
3522
|
-
}
|
|
3523
|
-
if (search) {
|
|
3524
|
-
url += `?${search}`;
|
|
3525
|
-
}
|
|
3526
|
-
return url;
|
|
3527
|
-
}, "getUrl");
|
|
3528
|
-
function getValidRequestBody3(options) {
|
|
3529
|
-
const hasBody = options.body !== void 0;
|
|
3530
|
-
const isSerializedBody = hasBody && options.bodySerializer;
|
|
3531
|
-
if (isSerializedBody) {
|
|
3532
|
-
if ("serializedBody" in options) {
|
|
3533
|
-
const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
|
|
3534
|
-
return hasSerializedBody ? options.serializedBody : null;
|
|
3535
|
-
}
|
|
3536
|
-
return options.body !== "" ? options.body : null;
|
|
3537
|
-
}
|
|
3538
|
-
if (hasBody) {
|
|
3539
|
-
return options.body;
|
|
3540
|
-
}
|
|
3541
|
-
return void 0;
|
|
3542
|
-
}
|
|
3543
|
-
__name(getValidRequestBody3, "getValidRequestBody");
|
|
3544
|
-
|
|
3545
|
-
// src/_api/generated/cfg_totp/core/auth.gen.ts
|
|
3546
|
-
var getAuthToken3 = /* @__PURE__ */ __name(async (auth, callback) => {
|
|
3547
|
-
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
3548
|
-
if (!token) {
|
|
3549
|
-
return;
|
|
3550
|
-
}
|
|
3551
|
-
if (auth.scheme === "bearer") {
|
|
3552
|
-
return `Bearer ${token}`;
|
|
3553
|
-
}
|
|
3554
|
-
if (auth.scheme === "basic") {
|
|
3555
|
-
return `Basic ${btoa(token)}`;
|
|
3556
|
-
}
|
|
3557
|
-
return token;
|
|
3558
|
-
}, "getAuthToken");
|
|
3559
|
-
|
|
3560
|
-
// src/_api/generated/cfg_totp/client/utils.gen.ts
|
|
3561
|
-
var createQuerySerializer3 = /* @__PURE__ */ __name(({
|
|
3562
|
-
parameters = {},
|
|
3563
|
-
...args
|
|
3564
|
-
} = {}) => {
|
|
3565
|
-
const querySerializer = /* @__PURE__ */ __name((queryParams) => {
|
|
3566
|
-
const search = [];
|
|
3567
|
-
if (queryParams && typeof queryParams === "object") {
|
|
3568
|
-
for (const name in queryParams) {
|
|
3569
|
-
const value = queryParams[name];
|
|
3570
|
-
if (value === void 0 || value === null) {
|
|
3571
|
-
continue;
|
|
3572
|
-
}
|
|
3573
|
-
const options = parameters[name] || args;
|
|
3574
|
-
if (Array.isArray(value)) {
|
|
3575
|
-
const serializedArray = serializeArrayParam3({
|
|
3576
|
-
allowReserved: options.allowReserved,
|
|
3577
|
-
explode: true,
|
|
3578
|
-
name,
|
|
3579
|
-
style: "form",
|
|
3580
|
-
value,
|
|
3581
|
-
...options.array
|
|
3582
|
-
});
|
|
3583
|
-
if (serializedArray) search.push(serializedArray);
|
|
3584
|
-
} else if (typeof value === "object") {
|
|
3585
|
-
const serializedObject = serializeObjectParam3({
|
|
3586
|
-
allowReserved: options.allowReserved,
|
|
3587
|
-
explode: true,
|
|
3588
|
-
name,
|
|
3589
|
-
style: "deepObject",
|
|
3590
|
-
value,
|
|
3591
|
-
...options.object
|
|
3592
|
-
});
|
|
3593
|
-
if (serializedObject) search.push(serializedObject);
|
|
3594
|
-
} else {
|
|
3595
|
-
const serializedPrimitive = serializePrimitiveParam3({
|
|
3596
|
-
allowReserved: options.allowReserved,
|
|
3597
|
-
name,
|
|
3598
|
-
value
|
|
3599
|
-
});
|
|
3600
|
-
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
3601
|
-
}
|
|
3602
|
-
}
|
|
3603
|
-
}
|
|
3604
|
-
return search.join("&");
|
|
3605
|
-
}, "querySerializer");
|
|
3606
|
-
return querySerializer;
|
|
3607
|
-
}, "createQuerySerializer");
|
|
3608
|
-
var getParseAs3 = /* @__PURE__ */ __name((contentType) => {
|
|
3609
|
-
if (!contentType) {
|
|
3610
|
-
return "stream";
|
|
3611
|
-
}
|
|
3612
|
-
const cleanContent = contentType.split(";")[0]?.trim();
|
|
3613
|
-
if (!cleanContent) {
|
|
3614
|
-
return;
|
|
3615
|
-
}
|
|
3616
|
-
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
|
3617
|
-
return "json";
|
|
3618
|
-
}
|
|
3619
|
-
if (cleanContent === "multipart/form-data") {
|
|
3620
|
-
return "formData";
|
|
3621
|
-
}
|
|
3622
|
-
if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
|
|
3623
|
-
return "blob";
|
|
3624
|
-
}
|
|
3625
|
-
if (cleanContent.startsWith("text/")) {
|
|
3626
|
-
return "text";
|
|
3627
|
-
}
|
|
3628
|
-
return;
|
|
3629
|
-
}, "getParseAs");
|
|
3630
|
-
var checkForExistence3 = /* @__PURE__ */ __name((options, name) => {
|
|
3631
|
-
if (!name) {
|
|
3632
|
-
return false;
|
|
3633
|
-
}
|
|
3634
|
-
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
3635
|
-
return true;
|
|
3636
|
-
}
|
|
3637
|
-
return false;
|
|
3638
|
-
}, "checkForExistence");
|
|
3639
|
-
var setAuthParams3 = /* @__PURE__ */ __name(async ({
|
|
3640
|
-
security,
|
|
3641
|
-
...options
|
|
3642
|
-
}) => {
|
|
3643
|
-
for (const auth of security) {
|
|
3644
|
-
if (checkForExistence3(options, auth.name)) {
|
|
3645
|
-
continue;
|
|
3646
|
-
}
|
|
3647
|
-
const token = await getAuthToken3(auth, options.auth);
|
|
3648
|
-
if (!token) {
|
|
3649
|
-
continue;
|
|
3650
|
-
}
|
|
3651
|
-
const name = auth.name ?? "Authorization";
|
|
3652
|
-
switch (auth.in) {
|
|
3653
|
-
case "query":
|
|
3654
|
-
if (!options.query) {
|
|
3655
|
-
options.query = {};
|
|
3656
|
-
}
|
|
3657
|
-
options.query[name] = token;
|
|
3658
|
-
break;
|
|
3659
|
-
case "cookie":
|
|
3660
|
-
options.headers.append("Cookie", `${name}=${token}`);
|
|
3661
|
-
break;
|
|
3662
|
-
case "header":
|
|
3663
|
-
default:
|
|
3664
|
-
options.headers.set(name, token);
|
|
3665
|
-
break;
|
|
3666
|
-
}
|
|
3667
|
-
}
|
|
3668
|
-
}, "setAuthParams");
|
|
3669
|
-
var buildUrl3 = /* @__PURE__ */ __name((options) => getUrl3({
|
|
3670
|
-
baseUrl: options.baseUrl,
|
|
3671
|
-
path: options.path,
|
|
3672
|
-
query: options.query,
|
|
3673
|
-
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer3(options.querySerializer),
|
|
3674
|
-
url: options.url
|
|
3675
|
-
}), "buildUrl");
|
|
3676
|
-
var mergeConfigs3 = /* @__PURE__ */ __name((a, b) => {
|
|
3677
|
-
const config = { ...a, ...b };
|
|
3678
|
-
if (config.baseUrl?.endsWith("/")) {
|
|
3679
|
-
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
1896
|
+
/**
|
|
1897
|
+
* Get current user profile
|
|
1898
|
+
*
|
|
1899
|
+
* Retrieve the current authenticated user's profile information.
|
|
1900
|
+
*/
|
|
1901
|
+
static cfgAccountsProfileRetrieve(options) {
|
|
1902
|
+
return (options?.client ?? client).get({
|
|
1903
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1904
|
+
in: "cookie",
|
|
1905
|
+
name: "sessionid",
|
|
1906
|
+
type: "apiKey"
|
|
1907
|
+
}],
|
|
1908
|
+
url: "/cfg/accounts/profile/",
|
|
1909
|
+
...options
|
|
1910
|
+
});
|
|
3680
1911
|
}
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
continue;
|
|
3696
|
-
}
|
|
3697
|
-
const iterator = header instanceof Headers ? headersEntries3(header) : Object.entries(header);
|
|
3698
|
-
for (const [key, value] of iterator) {
|
|
3699
|
-
if (value === null) {
|
|
3700
|
-
mergedHeaders.delete(key);
|
|
3701
|
-
} else if (Array.isArray(value)) {
|
|
3702
|
-
for (const v of value) {
|
|
3703
|
-
mergedHeaders.append(key, v);
|
|
3704
|
-
}
|
|
3705
|
-
} else if (value !== void 0) {
|
|
3706
|
-
mergedHeaders.set(
|
|
3707
|
-
key,
|
|
3708
|
-
typeof value === "object" ? JSON.stringify(value) : value
|
|
3709
|
-
);
|
|
1912
|
+
/**
|
|
1913
|
+
* Upload user avatar
|
|
1914
|
+
*
|
|
1915
|
+
* Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
|
|
1916
|
+
*/
|
|
1917
|
+
static cfgAccountsProfileAvatarCreate(options) {
|
|
1918
|
+
return (options?.client ?? client).post({
|
|
1919
|
+
...formDataBodySerializer,
|
|
1920
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
1921
|
+
url: "/cfg/accounts/profile/avatar/",
|
|
1922
|
+
...options,
|
|
1923
|
+
headers: {
|
|
1924
|
+
"Content-Type": null,
|
|
1925
|
+
...options?.headers
|
|
3710
1926
|
}
|
|
3711
|
-
}
|
|
3712
|
-
}
|
|
3713
|
-
return mergedHeaders;
|
|
3714
|
-
}, "mergeHeaders");
|
|
3715
|
-
var Interceptors3 = class {
|
|
3716
|
-
static {
|
|
3717
|
-
__name(this, "Interceptors");
|
|
3718
|
-
}
|
|
3719
|
-
fns = [];
|
|
3720
|
-
clear() {
|
|
3721
|
-
this.fns = [];
|
|
3722
|
-
}
|
|
3723
|
-
eject(id) {
|
|
3724
|
-
const index = this.getInterceptorIndex(id);
|
|
3725
|
-
if (this.fns[index]) {
|
|
3726
|
-
this.fns[index] = null;
|
|
3727
|
-
}
|
|
3728
|
-
}
|
|
3729
|
-
exists(id) {
|
|
3730
|
-
const index = this.getInterceptorIndex(id);
|
|
3731
|
-
return Boolean(this.fns[index]);
|
|
3732
|
-
}
|
|
3733
|
-
getInterceptorIndex(id) {
|
|
3734
|
-
if (typeof id === "number") {
|
|
3735
|
-
return this.fns[id] ? id : -1;
|
|
3736
|
-
}
|
|
3737
|
-
return this.fns.indexOf(id);
|
|
3738
|
-
}
|
|
3739
|
-
update(id, fn) {
|
|
3740
|
-
const index = this.getInterceptorIndex(id);
|
|
3741
|
-
if (this.fns[index]) {
|
|
3742
|
-
this.fns[index] = fn;
|
|
3743
|
-
return id;
|
|
3744
|
-
}
|
|
3745
|
-
return false;
|
|
3746
|
-
}
|
|
3747
|
-
use(fn) {
|
|
3748
|
-
this.fns.push(fn);
|
|
3749
|
-
return this.fns.length - 1;
|
|
1927
|
+
});
|
|
3750
1928
|
}
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
1929
|
+
/**
|
|
1930
|
+
* Delete user account
|
|
1931
|
+
*
|
|
1932
|
+
*
|
|
1933
|
+
* Permanently delete the current user's account.
|
|
1934
|
+
*
|
|
1935
|
+
* This operation:
|
|
1936
|
+
* - Deactivates the account (user cannot log in)
|
|
1937
|
+
* - Anonymizes personal data (GDPR compliance)
|
|
1938
|
+
* - Frees up the email address for re-registration
|
|
1939
|
+
* - Preserves audit trail
|
|
1940
|
+
*
|
|
1941
|
+
* The account can be restored by an administrator if needed.
|
|
1942
|
+
*
|
|
1943
|
+
*/
|
|
1944
|
+
static cfgAccountsProfileDeleteCreate(options) {
|
|
1945
|
+
return (options?.client ?? client).post({
|
|
1946
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1947
|
+
in: "cookie",
|
|
1948
|
+
name: "sessionid",
|
|
1949
|
+
type: "apiKey"
|
|
1950
|
+
}],
|
|
1951
|
+
url: "/cfg/accounts/profile/delete/",
|
|
1952
|
+
...options
|
|
1953
|
+
});
|
|
3766
1954
|
}
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
var createClient3 = /* @__PURE__ */ __name((config = {}) => {
|
|
3781
|
-
let _config = mergeConfigs3(createConfig3(), config);
|
|
3782
|
-
const getConfig = /* @__PURE__ */ __name(() => ({ ..._config }), "getConfig");
|
|
3783
|
-
const setConfig = /* @__PURE__ */ __name((config2) => {
|
|
3784
|
-
_config = mergeConfigs3(_config, config2);
|
|
3785
|
-
return getConfig();
|
|
3786
|
-
}, "setConfig");
|
|
3787
|
-
const interceptors = createInterceptors3();
|
|
3788
|
-
const beforeRequest = /* @__PURE__ */ __name(async (options) => {
|
|
3789
|
-
const opts = {
|
|
3790
|
-
..._config,
|
|
1955
|
+
/**
|
|
1956
|
+
* Partial update user profile
|
|
1957
|
+
*
|
|
1958
|
+
* Partially update the current authenticated user's profile information. Supports avatar upload.
|
|
1959
|
+
*/
|
|
1960
|
+
static cfgAccountsProfilePartialPartialUpdate(options) {
|
|
1961
|
+
return (options?.client ?? client).patch({
|
|
1962
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1963
|
+
in: "cookie",
|
|
1964
|
+
name: "sessionid",
|
|
1965
|
+
type: "apiKey"
|
|
1966
|
+
}],
|
|
1967
|
+
url: "/cfg/accounts/profile/partial/",
|
|
3791
1968
|
...options,
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
};
|
|
3796
|
-
if (opts.security) {
|
|
3797
|
-
await setAuthParams3({
|
|
3798
|
-
...opts,
|
|
3799
|
-
security: opts.security
|
|
3800
|
-
});
|
|
3801
|
-
}
|
|
3802
|
-
if (opts.requestValidator) {
|
|
3803
|
-
await opts.requestValidator(opts);
|
|
3804
|
-
}
|
|
3805
|
-
if (opts.body !== void 0 && opts.bodySerializer) {
|
|
3806
|
-
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
3807
|
-
}
|
|
3808
|
-
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
3809
|
-
opts.headers.delete("Content-Type");
|
|
3810
|
-
}
|
|
3811
|
-
const resolvedOpts = opts;
|
|
3812
|
-
const url = buildUrl3(resolvedOpts);
|
|
3813
|
-
return { opts: resolvedOpts, url };
|
|
3814
|
-
}, "beforeRequest");
|
|
3815
|
-
const request = /* @__PURE__ */ __name(async (options) => {
|
|
3816
|
-
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
3817
|
-
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
3818
|
-
let request2;
|
|
3819
|
-
let response;
|
|
3820
|
-
try {
|
|
3821
|
-
const { opts, url } = await beforeRequest(options);
|
|
3822
|
-
const requestInit = {
|
|
3823
|
-
redirect: "follow",
|
|
3824
|
-
...opts,
|
|
3825
|
-
body: getValidRequestBody3(opts)
|
|
3826
|
-
};
|
|
3827
|
-
request2 = new Request(url, requestInit);
|
|
3828
|
-
for (const fn of interceptors.request.fns) {
|
|
3829
|
-
if (fn) {
|
|
3830
|
-
request2 = await fn(request2, opts);
|
|
3831
|
-
}
|
|
3832
|
-
}
|
|
3833
|
-
const _fetch = opts.fetch;
|
|
3834
|
-
response = await _fetch(request2);
|
|
3835
|
-
for (const fn of interceptors.response.fns) {
|
|
3836
|
-
if (fn) {
|
|
3837
|
-
response = await fn(response, request2, opts);
|
|
3838
|
-
}
|
|
1969
|
+
headers: {
|
|
1970
|
+
"Content-Type": "application/json",
|
|
1971
|
+
...options?.headers
|
|
3839
1972
|
}
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
break;
|
|
3860
|
-
case "json":
|
|
3861
|
-
default:
|
|
3862
|
-
emptyData = {};
|
|
3863
|
-
break;
|
|
3864
|
-
}
|
|
3865
|
-
return opts.responseStyle === "data" ? emptyData : {
|
|
3866
|
-
data: emptyData,
|
|
3867
|
-
...result
|
|
3868
|
-
};
|
|
3869
|
-
}
|
|
3870
|
-
let data;
|
|
3871
|
-
switch (parseAs) {
|
|
3872
|
-
case "arrayBuffer":
|
|
3873
|
-
case "blob":
|
|
3874
|
-
case "formData":
|
|
3875
|
-
case "text":
|
|
3876
|
-
data = await response[parseAs]();
|
|
3877
|
-
break;
|
|
3878
|
-
case "json": {
|
|
3879
|
-
const text = await response.text();
|
|
3880
|
-
data = text ? JSON.parse(text) : {};
|
|
3881
|
-
break;
|
|
3882
|
-
}
|
|
3883
|
-
case "stream":
|
|
3884
|
-
return opts.responseStyle === "data" ? response.body : {
|
|
3885
|
-
data: response.body,
|
|
3886
|
-
...result
|
|
3887
|
-
};
|
|
3888
|
-
}
|
|
3889
|
-
if (parseAs === "json") {
|
|
3890
|
-
if (opts.responseValidator) {
|
|
3891
|
-
await opts.responseValidator(data);
|
|
3892
|
-
}
|
|
3893
|
-
if (opts.responseTransformer) {
|
|
3894
|
-
data = await opts.responseTransformer(data);
|
|
3895
|
-
}
|
|
3896
|
-
}
|
|
3897
|
-
return opts.responseStyle === "data" ? data : {
|
|
3898
|
-
data,
|
|
3899
|
-
...result
|
|
3900
|
-
};
|
|
1973
|
+
});
|
|
1974
|
+
}
|
|
1975
|
+
/**
|
|
1976
|
+
* Partial update user profile
|
|
1977
|
+
*
|
|
1978
|
+
* Partially update the current authenticated user's profile information. Supports avatar upload.
|
|
1979
|
+
*/
|
|
1980
|
+
static cfgAccountsProfilePartialUpdate(options) {
|
|
1981
|
+
return (options?.client ?? client).put({
|
|
1982
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1983
|
+
in: "cookie",
|
|
1984
|
+
name: "sessionid",
|
|
1985
|
+
type: "apiKey"
|
|
1986
|
+
}],
|
|
1987
|
+
url: "/cfg/accounts/profile/partial/",
|
|
1988
|
+
...options,
|
|
1989
|
+
headers: {
|
|
1990
|
+
"Content-Type": "application/json",
|
|
1991
|
+
...options?.headers
|
|
3901
1992
|
}
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
/**
|
|
1996
|
+
* Update user profile
|
|
1997
|
+
*
|
|
1998
|
+
* Update the current authenticated user's profile information.
|
|
1999
|
+
*/
|
|
2000
|
+
static cfgAccountsProfileUpdatePartialUpdate(options) {
|
|
2001
|
+
return (options?.client ?? client).patch({
|
|
2002
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
2003
|
+
in: "cookie",
|
|
2004
|
+
name: "sessionid",
|
|
2005
|
+
type: "apiKey"
|
|
2006
|
+
}],
|
|
2007
|
+
url: "/cfg/accounts/profile/update/",
|
|
2008
|
+
...options,
|
|
2009
|
+
headers: {
|
|
2010
|
+
"Content-Type": "application/json",
|
|
2011
|
+
...options?.headers
|
|
3907
2012
|
}
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
2013
|
+
});
|
|
2014
|
+
}
|
|
2015
|
+
/**
|
|
2016
|
+
* Update user profile
|
|
2017
|
+
*
|
|
2018
|
+
* Update the current authenticated user's profile information.
|
|
2019
|
+
*/
|
|
2020
|
+
static cfgAccountsProfileUpdateUpdate(options) {
|
|
2021
|
+
return (options?.client ?? client).put({
|
|
2022
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
2023
|
+
in: "cookie",
|
|
2024
|
+
name: "sessionid",
|
|
2025
|
+
type: "apiKey"
|
|
2026
|
+
}],
|
|
2027
|
+
url: "/cfg/accounts/profile/update/",
|
|
2028
|
+
...options,
|
|
2029
|
+
headers: {
|
|
2030
|
+
"Content-Type": "application/json",
|
|
2031
|
+
...options?.headers
|
|
3915
2032
|
}
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
2033
|
+
});
|
|
2034
|
+
}
|
|
2035
|
+
/**
|
|
2036
|
+
* Refresh JWT token.
|
|
2037
|
+
*/
|
|
2038
|
+
static cfgAccountsTokenRefreshCreate(options) {
|
|
2039
|
+
return (options.client ?? client).post({
|
|
2040
|
+
url: "/cfg/accounts/token/refresh/",
|
|
2041
|
+
...options,
|
|
2042
|
+
headers: {
|
|
2043
|
+
"Content-Type": "application/json",
|
|
2044
|
+
...options.headers
|
|
3919
2045
|
}
|
|
3920
|
-
return responseStyle === "data" ? void 0 : {
|
|
3921
|
-
error: finalError,
|
|
3922
|
-
request: request2,
|
|
3923
|
-
response
|
|
3924
|
-
};
|
|
3925
|
-
}
|
|
3926
|
-
}, "request");
|
|
3927
|
-
const makeMethodFn = /* @__PURE__ */ __name((method) => (options) => request({ ...options, method }), "makeMethodFn");
|
|
3928
|
-
const makeSseFn = /* @__PURE__ */ __name((method) => async (options) => {
|
|
3929
|
-
const { opts, url } = await beforeRequest(options);
|
|
3930
|
-
return createSseClient3({
|
|
3931
|
-
...opts,
|
|
3932
|
-
body: opts.body,
|
|
3933
|
-
method,
|
|
3934
|
-
onRequest: /* @__PURE__ */ __name(async (url2, init) => {
|
|
3935
|
-
let request2 = new Request(url2, init);
|
|
3936
|
-
for (const fn of interceptors.request.fns) {
|
|
3937
|
-
if (fn) {
|
|
3938
|
-
request2 = await fn(request2, opts);
|
|
3939
|
-
}
|
|
3940
|
-
}
|
|
3941
|
-
return request2;
|
|
3942
|
-
}, "onRequest"),
|
|
3943
|
-
serializedBody: getValidRequestBody3(opts),
|
|
3944
|
-
url
|
|
3945
2046
|
});
|
|
3946
|
-
}
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
buildUrl: _buildUrl,
|
|
3950
|
-
connect: makeMethodFn("CONNECT"),
|
|
3951
|
-
delete: makeMethodFn("DELETE"),
|
|
3952
|
-
get: makeMethodFn("GET"),
|
|
3953
|
-
getConfig,
|
|
3954
|
-
head: makeMethodFn("HEAD"),
|
|
3955
|
-
interceptors,
|
|
3956
|
-
options: makeMethodFn("OPTIONS"),
|
|
3957
|
-
patch: makeMethodFn("PATCH"),
|
|
3958
|
-
post: makeMethodFn("POST"),
|
|
3959
|
-
put: makeMethodFn("PUT"),
|
|
3960
|
-
request,
|
|
3961
|
-
setConfig,
|
|
3962
|
-
sse: {
|
|
3963
|
-
connect: makeSseFn("CONNECT"),
|
|
3964
|
-
delete: makeSseFn("DELETE"),
|
|
3965
|
-
get: makeSseFn("GET"),
|
|
3966
|
-
head: makeSseFn("HEAD"),
|
|
3967
|
-
options: makeSseFn("OPTIONS"),
|
|
3968
|
-
patch: makeSseFn("PATCH"),
|
|
3969
|
-
post: makeSseFn("POST"),
|
|
3970
|
-
put: makeSseFn("PUT"),
|
|
3971
|
-
trace: makeSseFn("TRACE")
|
|
3972
|
-
},
|
|
3973
|
-
trace: makeMethodFn("TRACE")
|
|
3974
|
-
};
|
|
3975
|
-
}, "createClient");
|
|
3976
|
-
|
|
3977
|
-
// src/_api/generated/cfg_totp/client.gen.ts
|
|
3978
|
-
var client3 = createClient3(createConfig3({ baseUrl: "http://localhost:8000" }));
|
|
3979
|
-
|
|
3980
|
-
// src/_api/generated/cfg_totp/sdk.gen.ts
|
|
3981
|
-
var Cfg3 = class {
|
|
2047
|
+
}
|
|
2048
|
+
};
|
|
2049
|
+
var OAuth = class {
|
|
3982
2050
|
static {
|
|
3983
|
-
__name(this, "
|
|
2051
|
+
__name(this, "OAuth");
|
|
3984
2052
|
}
|
|
3985
2053
|
/**
|
|
3986
|
-
*
|
|
2054
|
+
* List OAuth connections
|
|
2055
|
+
*
|
|
2056
|
+
* Get all OAuth connections for the current user.
|
|
3987
2057
|
*/
|
|
3988
|
-
static
|
|
3989
|
-
return (options?.client ??
|
|
2058
|
+
static cfgAccountsOauthConnectionsList(options) {
|
|
2059
|
+
return (options?.client ?? client).get({
|
|
3990
2060
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3991
|
-
url: "/cfg/
|
|
2061
|
+
url: "/cfg/accounts/oauth/connections/",
|
|
3992
2062
|
...options
|
|
3993
2063
|
});
|
|
3994
2064
|
}
|
|
3995
2065
|
/**
|
|
3996
|
-
*
|
|
2066
|
+
* Disconnect OAuth provider
|
|
3997
2067
|
*
|
|
3998
|
-
*
|
|
3999
|
-
* Invalidates all existing codes.
|
|
2068
|
+
* Remove OAuth connection for the specified provider.
|
|
4000
2069
|
*/
|
|
4001
|
-
static
|
|
4002
|
-
return (options.client ??
|
|
2070
|
+
static cfgAccountsOauthDisconnectCreate(options) {
|
|
2071
|
+
return (options.client ?? client).post({
|
|
4003
2072
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4004
|
-
url: "/cfg/
|
|
2073
|
+
url: "/cfg/accounts/oauth/disconnect/",
|
|
4005
2074
|
...options,
|
|
4006
2075
|
headers: {
|
|
4007
2076
|
"Content-Type": "application/json",
|
|
@@ -4010,52 +2079,140 @@ var Cfg3 = class {
|
|
|
4010
2079
|
});
|
|
4011
2080
|
}
|
|
4012
2081
|
/**
|
|
4013
|
-
*
|
|
2082
|
+
* Start GitHub OAuth
|
|
2083
|
+
*
|
|
2084
|
+
* Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
|
|
4014
2085
|
*/
|
|
4015
|
-
static
|
|
4016
|
-
return (options?.client ??
|
|
4017
|
-
|
|
4018
|
-
|
|
2086
|
+
static cfgAccountsOauthGithubAuthorizeCreate(options) {
|
|
2087
|
+
return (options?.client ?? client).post({
|
|
2088
|
+
url: "/cfg/accounts/oauth/github/authorize/",
|
|
2089
|
+
...options,
|
|
2090
|
+
headers: {
|
|
2091
|
+
"Content-Type": "application/json",
|
|
2092
|
+
...options?.headers
|
|
2093
|
+
}
|
|
2094
|
+
});
|
|
2095
|
+
}
|
|
2096
|
+
/**
|
|
2097
|
+
* Complete GitHub OAuth
|
|
2098
|
+
*
|
|
2099
|
+
* Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
|
|
2100
|
+
*/
|
|
2101
|
+
static cfgAccountsOauthGithubCallbackCreate(options) {
|
|
2102
|
+
return (options.client ?? client).post({
|
|
2103
|
+
url: "/cfg/accounts/oauth/github/callback/",
|
|
2104
|
+
...options,
|
|
2105
|
+
headers: {
|
|
2106
|
+
"Content-Type": "application/json",
|
|
2107
|
+
...options.headers
|
|
2108
|
+
}
|
|
2109
|
+
});
|
|
2110
|
+
}
|
|
2111
|
+
/**
|
|
2112
|
+
* List OAuth providers
|
|
2113
|
+
*
|
|
2114
|
+
* Get list of available OAuth providers for authentication.
|
|
2115
|
+
*/
|
|
2116
|
+
static cfgAccountsOauthProvidersRetrieve(options) {
|
|
2117
|
+
return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
|
|
2118
|
+
}
|
|
2119
|
+
};
|
|
2120
|
+
var UserProfile = class {
|
|
2121
|
+
static {
|
|
2122
|
+
__name(this, "UserProfile");
|
|
2123
|
+
}
|
|
2124
|
+
/**
|
|
2125
|
+
* Get current user profile
|
|
2126
|
+
*
|
|
2127
|
+
* Retrieve the current authenticated user's profile information.
|
|
2128
|
+
*/
|
|
2129
|
+
static cfgAccountsProfileRetrieve(options) {
|
|
2130
|
+
return (options?.client ?? client).get({
|
|
2131
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
2132
|
+
in: "cookie",
|
|
2133
|
+
name: "sessionid",
|
|
2134
|
+
type: "apiKey"
|
|
2135
|
+
}],
|
|
2136
|
+
url: "/cfg/accounts/profile/",
|
|
4019
2137
|
...options
|
|
4020
2138
|
});
|
|
4021
2139
|
}
|
|
4022
2140
|
/**
|
|
4023
|
-
*
|
|
2141
|
+
* Upload user avatar
|
|
4024
2142
|
*
|
|
4025
|
-
*
|
|
2143
|
+
* Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
|
|
4026
2144
|
*/
|
|
4027
|
-
static
|
|
4028
|
-
return (options
|
|
2145
|
+
static cfgAccountsProfileAvatarCreate(options) {
|
|
2146
|
+
return (options?.client ?? client).post({
|
|
2147
|
+
...formDataBodySerializer,
|
|
4029
2148
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4030
|
-
url: "/cfg/
|
|
2149
|
+
url: "/cfg/accounts/profile/avatar/",
|
|
2150
|
+
...options,
|
|
2151
|
+
headers: {
|
|
2152
|
+
"Content-Type": null,
|
|
2153
|
+
...options?.headers
|
|
2154
|
+
}
|
|
2155
|
+
});
|
|
2156
|
+
}
|
|
2157
|
+
/**
|
|
2158
|
+
* Delete user account
|
|
2159
|
+
*
|
|
2160
|
+
*
|
|
2161
|
+
* Permanently delete the current user's account.
|
|
2162
|
+
*
|
|
2163
|
+
* This operation:
|
|
2164
|
+
* - Deactivates the account (user cannot log in)
|
|
2165
|
+
* - Anonymizes personal data (GDPR compliance)
|
|
2166
|
+
* - Frees up the email address for re-registration
|
|
2167
|
+
* - Preserves audit trail
|
|
2168
|
+
*
|
|
2169
|
+
* The account can be restored by an administrator if needed.
|
|
2170
|
+
*
|
|
2171
|
+
*/
|
|
2172
|
+
static cfgAccountsProfileDeleteCreate(options) {
|
|
2173
|
+
return (options?.client ?? client).post({
|
|
2174
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
2175
|
+
in: "cookie",
|
|
2176
|
+
name: "sessionid",
|
|
2177
|
+
type: "apiKey"
|
|
2178
|
+
}],
|
|
2179
|
+
url: "/cfg/accounts/profile/delete/",
|
|
4031
2180
|
...options
|
|
4032
2181
|
});
|
|
4033
2182
|
}
|
|
4034
2183
|
/**
|
|
4035
|
-
*
|
|
2184
|
+
* Partial update user profile
|
|
4036
2185
|
*
|
|
4037
|
-
*
|
|
2186
|
+
* Partially update the current authenticated user's profile information. Supports avatar upload.
|
|
4038
2187
|
*/
|
|
4039
|
-
static
|
|
4040
|
-
return (options
|
|
4041
|
-
security: [{ scheme: "bearer", type: "http" }
|
|
4042
|
-
|
|
2188
|
+
static cfgAccountsProfilePartialPartialUpdate(options) {
|
|
2189
|
+
return (options?.client ?? client).patch({
|
|
2190
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
2191
|
+
in: "cookie",
|
|
2192
|
+
name: "sessionid",
|
|
2193
|
+
type: "apiKey"
|
|
2194
|
+
}],
|
|
2195
|
+
url: "/cfg/accounts/profile/partial/",
|
|
4043
2196
|
...options,
|
|
4044
2197
|
headers: {
|
|
4045
2198
|
"Content-Type": "application/json",
|
|
4046
|
-
...options
|
|
2199
|
+
...options?.headers
|
|
4047
2200
|
}
|
|
4048
2201
|
});
|
|
4049
2202
|
}
|
|
4050
2203
|
/**
|
|
4051
|
-
*
|
|
2204
|
+
* Partial update user profile
|
|
4052
2205
|
*
|
|
4053
|
-
*
|
|
2206
|
+
* Partially update the current authenticated user's profile information. Supports avatar upload.
|
|
4054
2207
|
*/
|
|
4055
|
-
static
|
|
4056
|
-
return (options?.client ??
|
|
4057
|
-
security: [{ scheme: "bearer", type: "http" }
|
|
4058
|
-
|
|
2208
|
+
static cfgAccountsProfilePartialUpdate(options) {
|
|
2209
|
+
return (options?.client ?? client).put({
|
|
2210
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
2211
|
+
in: "cookie",
|
|
2212
|
+
name: "sessionid",
|
|
2213
|
+
type: "apiKey"
|
|
2214
|
+
}],
|
|
2215
|
+
url: "/cfg/accounts/profile/partial/",
|
|
4059
2216
|
...options,
|
|
4060
2217
|
headers: {
|
|
4061
2218
|
"Content-Type": "application/json",
|
|
@@ -4064,46 +2221,56 @@ var Cfg3 = class {
|
|
|
4064
2221
|
});
|
|
4065
2222
|
}
|
|
4066
2223
|
/**
|
|
4067
|
-
*
|
|
2224
|
+
* Update user profile
|
|
4068
2225
|
*
|
|
4069
|
-
*
|
|
2226
|
+
* Update the current authenticated user's profile information.
|
|
4070
2227
|
*/
|
|
4071
|
-
static
|
|
4072
|
-
return (options
|
|
4073
|
-
security: [{ scheme: "bearer", type: "http" }
|
|
4074
|
-
|
|
2228
|
+
static cfgAccountsProfileUpdatePartialUpdate(options) {
|
|
2229
|
+
return (options?.client ?? client).patch({
|
|
2230
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
2231
|
+
in: "cookie",
|
|
2232
|
+
name: "sessionid",
|
|
2233
|
+
type: "apiKey"
|
|
2234
|
+
}],
|
|
2235
|
+
url: "/cfg/accounts/profile/update/",
|
|
4075
2236
|
...options,
|
|
4076
2237
|
headers: {
|
|
4077
2238
|
"Content-Type": "application/json",
|
|
4078
|
-
...options
|
|
2239
|
+
...options?.headers
|
|
4079
2240
|
}
|
|
4080
2241
|
});
|
|
4081
2242
|
}
|
|
4082
2243
|
/**
|
|
4083
|
-
*
|
|
2244
|
+
* Update user profile
|
|
4084
2245
|
*
|
|
4085
|
-
*
|
|
2246
|
+
* Update the current authenticated user's profile information.
|
|
4086
2247
|
*/
|
|
4087
|
-
static
|
|
4088
|
-
return (options
|
|
4089
|
-
security: [{ scheme: "bearer", type: "http" }
|
|
4090
|
-
|
|
2248
|
+
static cfgAccountsProfileUpdateUpdate(options) {
|
|
2249
|
+
return (options?.client ?? client).put({
|
|
2250
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
2251
|
+
in: "cookie",
|
|
2252
|
+
name: "sessionid",
|
|
2253
|
+
type: "apiKey"
|
|
2254
|
+
}],
|
|
2255
|
+
url: "/cfg/accounts/profile/update/",
|
|
4091
2256
|
...options,
|
|
4092
2257
|
headers: {
|
|
4093
2258
|
"Content-Type": "application/json",
|
|
4094
|
-
...options
|
|
2259
|
+
...options?.headers
|
|
4095
2260
|
}
|
|
4096
2261
|
});
|
|
4097
2262
|
}
|
|
2263
|
+
};
|
|
2264
|
+
var Auth = class {
|
|
2265
|
+
static {
|
|
2266
|
+
__name(this, "Auth");
|
|
2267
|
+
}
|
|
4098
2268
|
/**
|
|
4099
|
-
*
|
|
4100
|
-
*
|
|
4101
|
-
* Alternative verification method when TOTP device unavailable.
|
|
2269
|
+
* Refresh JWT token.
|
|
4102
2270
|
*/
|
|
4103
|
-
static
|
|
4104
|
-
return (options.client ??
|
|
4105
|
-
|
|
4106
|
-
url: "/cfg/totp/verify/backup/",
|
|
2271
|
+
static cfgAccountsTokenRefreshCreate(options) {
|
|
2272
|
+
return (options.client ?? client).post({
|
|
2273
|
+
url: "/cfg/accounts/token/refresh/",
|
|
4107
2274
|
...options,
|
|
4108
2275
|
headers: {
|
|
4109
2276
|
"Content-Type": "application/json",
|
|
@@ -4112,6 +2279,40 @@ var Cfg3 = class {
|
|
|
4112
2279
|
});
|
|
4113
2280
|
}
|
|
4114
2281
|
};
|
|
2282
|
+
var Centrifugo = class {
|
|
2283
|
+
static {
|
|
2284
|
+
__name(this, "Centrifugo");
|
|
2285
|
+
}
|
|
2286
|
+
/**
|
|
2287
|
+
* Get Centrifugo connection token
|
|
2288
|
+
*
|
|
2289
|
+
* Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
|
|
2290
|
+
*/
|
|
2291
|
+
static cfgCentrifugoAuthTokenRetrieve(options) {
|
|
2292
|
+
return (options?.client ?? client).get({
|
|
2293
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2294
|
+
url: "/cfg/centrifugo/auth/token/",
|
|
2295
|
+
...options
|
|
2296
|
+
});
|
|
2297
|
+
}
|
|
2298
|
+
};
|
|
2299
|
+
var CentrifugoAuth = class {
|
|
2300
|
+
static {
|
|
2301
|
+
__name(this, "CentrifugoAuth");
|
|
2302
|
+
}
|
|
2303
|
+
/**
|
|
2304
|
+
* Get Centrifugo connection token
|
|
2305
|
+
*
|
|
2306
|
+
* Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
|
|
2307
|
+
*/
|
|
2308
|
+
static cfgCentrifugoAuthTokenRetrieve(options) {
|
|
2309
|
+
return (options?.client ?? client).get({
|
|
2310
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
2311
|
+
url: "/cfg/centrifugo/auth/token/",
|
|
2312
|
+
...options
|
|
2313
|
+
});
|
|
2314
|
+
}
|
|
2315
|
+
};
|
|
4115
2316
|
var Totp = class {
|
|
4116
2317
|
static {
|
|
4117
2318
|
__name(this, "Totp");
|
|
@@ -4120,7 +2321,7 @@ var Totp = class {
|
|
|
4120
2321
|
* Get backup codes status for user.
|
|
4121
2322
|
*/
|
|
4122
2323
|
static cfgTotpBackupCodesRetrieve(options) {
|
|
4123
|
-
return (options?.client ??
|
|
2324
|
+
return (options?.client ?? client).get({
|
|
4124
2325
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4125
2326
|
url: "/cfg/totp/backup-codes/",
|
|
4126
2327
|
...options
|
|
@@ -4133,7 +2334,7 @@ var Totp = class {
|
|
|
4133
2334
|
* Invalidates all existing codes.
|
|
4134
2335
|
*/
|
|
4135
2336
|
static cfgTotpBackupCodesRegenerateCreate(options) {
|
|
4136
|
-
return (options.client ??
|
|
2337
|
+
return (options.client ?? client).post({
|
|
4137
2338
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4138
2339
|
url: "/cfg/totp/backup-codes/regenerate/",
|
|
4139
2340
|
...options,
|
|
@@ -4147,7 +2348,7 @@ var Totp = class {
|
|
|
4147
2348
|
* List all TOTP devices for user.
|
|
4148
2349
|
*/
|
|
4149
2350
|
static cfgTotpDevicesRetrieve(options) {
|
|
4150
|
-
return (options?.client ??
|
|
2351
|
+
return (options?.client ?? client).get({
|
|
4151
2352
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4152
2353
|
url: "/cfg/totp/devices/",
|
|
4153
2354
|
...options
|
|
@@ -4159,7 +2360,7 @@ var Totp = class {
|
|
|
4159
2360
|
* Requires verification code if removing the last/primary device.
|
|
4160
2361
|
*/
|
|
4161
2362
|
static cfgTotpDevicesDestroy(options) {
|
|
4162
|
-
return (options.client ??
|
|
2363
|
+
return (options.client ?? client).delete({
|
|
4163
2364
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4164
2365
|
url: "/cfg/totp/devices/{id}/",
|
|
4165
2366
|
...options
|
|
@@ -4171,7 +2372,7 @@ var Totp = class {
|
|
|
4171
2372
|
* Requires verification code.
|
|
4172
2373
|
*/
|
|
4173
2374
|
static cfgTotpDisableCreate(options) {
|
|
4174
|
-
return (options.client ??
|
|
2375
|
+
return (options.client ?? client).post({
|
|
4175
2376
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4176
2377
|
url: "/cfg/totp/disable/",
|
|
4177
2378
|
...options,
|
|
@@ -4187,7 +2388,7 @@ var Totp = class {
|
|
|
4187
2388
|
* Creates a new TOTP device and returns QR code for scanning.
|
|
4188
2389
|
*/
|
|
4189
2390
|
static cfgTotpSetupCreate(options) {
|
|
4190
|
-
return (options?.client ??
|
|
2391
|
+
return (options?.client ?? client).post({
|
|
4191
2392
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4192
2393
|
url: "/cfg/totp/setup/",
|
|
4193
2394
|
...options,
|
|
@@ -4203,7 +2404,7 @@ var Totp = class {
|
|
|
4203
2404
|
* Activates the device and generates backup codes.
|
|
4204
2405
|
*/
|
|
4205
2406
|
static cfgTotpSetupConfirmCreate(options) {
|
|
4206
|
-
return (options.client ??
|
|
2407
|
+
return (options.client ?? client).post({
|
|
4207
2408
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4208
2409
|
url: "/cfg/totp/setup/confirm/",
|
|
4209
2410
|
...options,
|
|
@@ -4219,7 +2420,7 @@ var Totp = class {
|
|
|
4219
2420
|
* Completes authentication and returns JWT tokens on success.
|
|
4220
2421
|
*/
|
|
4221
2422
|
static cfgTotpVerifyCreate(options) {
|
|
4222
|
-
return (options.client ??
|
|
2423
|
+
return (options.client ?? client).post({
|
|
4223
2424
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4224
2425
|
url: "/cfg/totp/verify/",
|
|
4225
2426
|
...options,
|
|
@@ -4235,7 +2436,7 @@ var Totp = class {
|
|
|
4235
2436
|
* Alternative verification method when TOTP device unavailable.
|
|
4236
2437
|
*/
|
|
4237
2438
|
static cfgTotpVerifyBackupCreate(options) {
|
|
4238
|
-
return (options.client ??
|
|
2439
|
+
return (options.client ?? client).post({
|
|
4239
2440
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4240
2441
|
url: "/cfg/totp/verify/backup/",
|
|
4241
2442
|
...options,
|
|
@@ -4254,7 +2455,7 @@ var BackupCodes = class {
|
|
|
4254
2455
|
* Get backup codes status for user.
|
|
4255
2456
|
*/
|
|
4256
2457
|
static cfgTotpBackupCodesRetrieve(options) {
|
|
4257
|
-
return (options?.client ??
|
|
2458
|
+
return (options?.client ?? client).get({
|
|
4258
2459
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4259
2460
|
url: "/cfg/totp/backup-codes/",
|
|
4260
2461
|
...options
|
|
@@ -4267,7 +2468,7 @@ var BackupCodes = class {
|
|
|
4267
2468
|
* Invalidates all existing codes.
|
|
4268
2469
|
*/
|
|
4269
2470
|
static cfgTotpBackupCodesRegenerateCreate(options) {
|
|
4270
|
-
return (options.client ??
|
|
2471
|
+
return (options.client ?? client).post({
|
|
4271
2472
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4272
2473
|
url: "/cfg/totp/backup-codes/regenerate/",
|
|
4273
2474
|
...options,
|
|
@@ -4286,7 +2487,7 @@ var TotpManagement = class {
|
|
|
4286
2487
|
* List all TOTP devices for user.
|
|
4287
2488
|
*/
|
|
4288
2489
|
static cfgTotpDevicesRetrieve(options) {
|
|
4289
|
-
return (options?.client ??
|
|
2490
|
+
return (options?.client ?? client).get({
|
|
4290
2491
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4291
2492
|
url: "/cfg/totp/devices/",
|
|
4292
2493
|
...options
|
|
@@ -4298,7 +2499,7 @@ var TotpManagement = class {
|
|
|
4298
2499
|
* Requires verification code.
|
|
4299
2500
|
*/
|
|
4300
2501
|
static cfgTotpDisableCreate(options) {
|
|
4301
|
-
return (options.client ??
|
|
2502
|
+
return (options.client ?? client).post({
|
|
4302
2503
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4303
2504
|
url: "/cfg/totp/disable/",
|
|
4304
2505
|
...options,
|
|
@@ -4319,7 +2520,7 @@ var TotpSetup = class {
|
|
|
4319
2520
|
* Creates a new TOTP device and returns QR code for scanning.
|
|
4320
2521
|
*/
|
|
4321
2522
|
static cfgTotpSetupCreate(options) {
|
|
4322
|
-
return (options?.client ??
|
|
2523
|
+
return (options?.client ?? client).post({
|
|
4323
2524
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4324
2525
|
url: "/cfg/totp/setup/",
|
|
4325
2526
|
...options,
|
|
@@ -4335,7 +2536,7 @@ var TotpSetup = class {
|
|
|
4335
2536
|
* Activates the device and generates backup codes.
|
|
4336
2537
|
*/
|
|
4337
2538
|
static cfgTotpSetupConfirmCreate(options) {
|
|
4338
|
-
return (options.client ??
|
|
2539
|
+
return (options.client ?? client).post({
|
|
4339
2540
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4340
2541
|
url: "/cfg/totp/setup/confirm/",
|
|
4341
2542
|
...options,
|
|
@@ -4356,7 +2557,7 @@ var TotpVerification = class {
|
|
|
4356
2557
|
* Completes authentication and returns JWT tokens on success.
|
|
4357
2558
|
*/
|
|
4358
2559
|
static cfgTotpVerifyCreate(options) {
|
|
4359
|
-
return (options.client ??
|
|
2560
|
+
return (options.client ?? client).post({
|
|
4360
2561
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4361
2562
|
url: "/cfg/totp/verify/",
|
|
4362
2563
|
...options,
|
|
@@ -4372,7 +2573,7 @@ var TotpVerification = class {
|
|
|
4372
2573
|
* Alternative verification method when TOTP device unavailable.
|
|
4373
2574
|
*/
|
|
4374
2575
|
static cfgTotpVerifyBackupCreate(options) {
|
|
4375
|
-
return (options.client ??
|
|
2576
|
+
return (options.client ?? client).post({
|
|
4376
2577
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4377
2578
|
url: "/cfg/totp/verify/backup/",
|
|
4378
2579
|
...options,
|
|
@@ -4383,275 +2584,6 @@ var TotpVerification = class {
|
|
|
4383
2584
|
});
|
|
4384
2585
|
}
|
|
4385
2586
|
};
|
|
4386
|
-
|
|
4387
|
-
// src/_api/generated/cfg_totp/schemas/BackupCodesRegenerateRequest.ts
|
|
4388
|
-
import { z as z23 } from "zod";
|
|
4389
|
-
var BackupCodesRegenerateRequestSchema = z23.object({
|
|
4390
|
-
code: z23.string().min(6).max(6)
|
|
4391
|
-
});
|
|
4392
|
-
|
|
4393
|
-
// src/_api/generated/cfg_totp/schemas/BackupCodesRegenerateResponse.ts
|
|
4394
|
-
import { z as z24 } from "zod";
|
|
4395
|
-
var BackupCodesRegenerateResponseSchema = z24.object({
|
|
4396
|
-
backup_codes: z24.array(z24.string()),
|
|
4397
|
-
warning: z24.string()
|
|
4398
|
-
});
|
|
4399
|
-
|
|
4400
|
-
// src/_api/generated/cfg_totp/schemas/BackupCodesStatus.ts
|
|
4401
|
-
import { z as z25 } from "zod";
|
|
4402
|
-
var BackupCodesStatusSchema = z25.object({
|
|
4403
|
-
remaining_count: z25.number().int(),
|
|
4404
|
-
total_generated: z25.number().int(),
|
|
4405
|
-
warning: z25.string().nullable().optional()
|
|
4406
|
-
});
|
|
4407
|
-
|
|
4408
|
-
// src/_api/generated/cfg_totp/schemas/ConfirmSetupRequest.ts
|
|
4409
|
-
import { z as z26 } from "zod";
|
|
4410
|
-
var ConfirmSetupRequestSchema = z26.object({
|
|
4411
|
-
device_id: z26.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
|
|
4412
|
-
code: z26.string().min(6).max(6)
|
|
4413
|
-
});
|
|
4414
|
-
|
|
4415
|
-
// src/_api/generated/cfg_totp/schemas/ConfirmSetupResponse.ts
|
|
4416
|
-
import { z as z27 } from "zod";
|
|
4417
|
-
var ConfirmSetupResponseSchema = z27.object({
|
|
4418
|
-
message: z27.string(),
|
|
4419
|
-
backup_codes: z27.array(z27.string()),
|
|
4420
|
-
backup_codes_warning: z27.string()
|
|
4421
|
-
});
|
|
4422
|
-
|
|
4423
|
-
// src/_api/generated/cfg_totp/schemas/DeviceList.ts
|
|
4424
|
-
import { z as z29 } from "zod";
|
|
4425
|
-
|
|
4426
|
-
// src/_api/generated/cfg_totp/schemas/DeviceListStatusEnum.ts
|
|
4427
|
-
import { z as z28 } from "zod";
|
|
4428
|
-
var DeviceListStatusEnumSchema = z28.enum(["pending", "active", "disabled"]);
|
|
4429
|
-
|
|
4430
|
-
// src/_api/generated/cfg_totp/schemas/DeviceList.ts
|
|
4431
|
-
var DeviceListSchema = z29.object({
|
|
4432
|
-
id: z29.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
|
|
4433
|
-
name: z29.string(),
|
|
4434
|
-
is_primary: z29.boolean(),
|
|
4435
|
-
status: DeviceListStatusEnumSchema,
|
|
4436
|
-
created_at: z29.string().datetime({ offset: true }),
|
|
4437
|
-
confirmed_at: z29.string().datetime({ offset: true }).nullable(),
|
|
4438
|
-
last_used_at: z29.string().datetime({ offset: true }).nullable()
|
|
4439
|
-
});
|
|
4440
|
-
|
|
4441
|
-
// src/_api/generated/cfg_totp/schemas/DeviceListResponse.ts
|
|
4442
|
-
import { z as z30 } from "zod";
|
|
4443
|
-
var DeviceListResponseSchema = z30.object({
|
|
4444
|
-
devices: z30.array(DeviceListSchema),
|
|
4445
|
-
has_2fa_enabled: z30.boolean()
|
|
4446
|
-
});
|
|
4447
|
-
|
|
4448
|
-
// src/_api/generated/cfg_totp/schemas/DisableRequest.ts
|
|
4449
|
-
import { z as z31 } from "zod";
|
|
4450
|
-
var DisableRequestSchema = z31.object({
|
|
4451
|
-
code: z31.string().min(6).max(6)
|
|
4452
|
-
});
|
|
4453
|
-
|
|
4454
|
-
// src/_api/generated/cfg_totp/schemas/SetupRequest.ts
|
|
4455
|
-
import { z as z32 } from "zod";
|
|
4456
|
-
var SetupRequestSchema = z32.object({
|
|
4457
|
-
device_name: z32.string().min(1).max(100).optional()
|
|
4458
|
-
});
|
|
4459
|
-
|
|
4460
|
-
// src/_api/generated/cfg_totp/schemas/SetupResponse.ts
|
|
4461
|
-
import { z as z33 } from "zod";
|
|
4462
|
-
var SetupResponseSchema = z33.object({
|
|
4463
|
-
device_id: z33.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
|
|
4464
|
-
secret: z33.string(),
|
|
4465
|
-
provisioning_uri: z33.string(),
|
|
4466
|
-
qr_code_base64: z33.string(),
|
|
4467
|
-
expires_in: z33.number().int()
|
|
4468
|
-
});
|
|
4469
|
-
|
|
4470
|
-
// src/_api/generated/cfg_totp/schemas/TotpVerifyUser.ts
|
|
4471
|
-
import { z as z34 } from "zod";
|
|
4472
|
-
var TotpVerifyUserSchema = z34.object({
|
|
4473
|
-
id: z34.number().int(),
|
|
4474
|
-
email: z34.email(),
|
|
4475
|
-
first_name: z34.string().max(50).optional(),
|
|
4476
|
-
last_name: z34.string().max(50).optional(),
|
|
4477
|
-
full_name: z34.string(),
|
|
4478
|
-
initials: z34.string(),
|
|
4479
|
-
display_username: z34.string(),
|
|
4480
|
-
company: z34.string().max(100).optional(),
|
|
4481
|
-
phone: z34.string().max(20).optional(),
|
|
4482
|
-
position: z34.string().max(100).optional(),
|
|
4483
|
-
language: z34.string().max(10).optional(),
|
|
4484
|
-
avatar: z34.string().nullable(),
|
|
4485
|
-
is_staff: z34.boolean(),
|
|
4486
|
-
is_superuser: z34.boolean(),
|
|
4487
|
-
date_joined: z34.string().datetime({ offset: true }),
|
|
4488
|
-
last_login: z34.string().datetime({ offset: true }).nullable(),
|
|
4489
|
-
unanswered_messages_count: z34.number().int()
|
|
4490
|
-
});
|
|
4491
|
-
|
|
4492
|
-
// src/_api/generated/cfg_totp/schemas/VerifyBackupRequest.ts
|
|
4493
|
-
import { z as z35 } from "zod";
|
|
4494
|
-
var VerifyBackupRequestSchema = z35.object({
|
|
4495
|
-
session_id: z35.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
|
|
4496
|
-
backup_code: z35.string().min(8).max(8)
|
|
4497
|
-
});
|
|
4498
|
-
|
|
4499
|
-
// src/_api/generated/cfg_totp/schemas/VerifyRequest.ts
|
|
4500
|
-
import { z as z36 } from "zod";
|
|
4501
|
-
var VerifyRequestSchema = z36.object({
|
|
4502
|
-
session_id: z36.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
|
|
4503
|
-
code: z36.string().min(6).max(6)
|
|
4504
|
-
});
|
|
4505
|
-
|
|
4506
|
-
// src/_api/generated/cfg_totp/schemas/VerifyResponse.ts
|
|
4507
|
-
import { z as z37 } from "zod";
|
|
4508
|
-
var VerifyResponseSchema = z37.object({
|
|
4509
|
-
message: z37.string(),
|
|
4510
|
-
access_token: z37.string(),
|
|
4511
|
-
refresh_token: z37.string(),
|
|
4512
|
-
user: TotpVerifyUserSchema,
|
|
4513
|
-
remaining_backup_codes: z37.number().int().optional(),
|
|
4514
|
-
warning: z37.string().optional()
|
|
4515
|
-
});
|
|
4516
|
-
|
|
4517
|
-
// src/_api/generated/cfg_totp/api.ts
|
|
4518
|
-
var ACCESS_KEY3 = "cfg.access_token";
|
|
4519
|
-
var REFRESH_KEY3 = "cfg.refresh_token";
|
|
4520
|
-
var VALIDATION_ROUTES3 = [
|
|
4521
|
-
{ method: "GET", re: new RegExp("^/cfg/totp/backup\\-codes/?$"), schema: BackupCodesStatusSchema, path: "/cfg/totp/backup-codes/" },
|
|
4522
|
-
{ method: "POST", re: new RegExp("^/cfg/totp/backup\\-codes/regenerate/?$"), schema: BackupCodesRegenerateResponseSchema, path: "/cfg/totp/backup-codes/regenerate/" },
|
|
4523
|
-
{ method: "GET", re: new RegExp("^/cfg/totp/devices/?$"), schema: DeviceListResponseSchema, path: "/cfg/totp/devices/" },
|
|
4524
|
-
{ method: "POST", re: new RegExp("^/cfg/totp/setup/?$"), schema: SetupResponseSchema, path: "/cfg/totp/setup/" },
|
|
4525
|
-
{ method: "POST", re: new RegExp("^/cfg/totp/setup/confirm/?$"), schema: ConfirmSetupResponseSchema, path: "/cfg/totp/setup/confirm/" },
|
|
4526
|
-
{ method: "POST", re: new RegExp("^/cfg/totp/verify/?$"), schema: VerifyResponseSchema, path: "/cfg/totp/verify/" },
|
|
4527
|
-
{ method: "POST", re: new RegExp("^/cfg/totp/verify/backup/?$"), schema: VerifyResponseSchema, path: "/cfg/totp/verify/backup/" }
|
|
4528
|
-
];
|
|
4529
|
-
function detectLocale3() {
|
|
4530
|
-
try {
|
|
4531
|
-
if (typeof document !== "undefined") {
|
|
4532
|
-
const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
4533
|
-
if (m) return decodeURIComponent(m[1]);
|
|
4534
|
-
}
|
|
4535
|
-
if (typeof navigator !== "undefined" && navigator.language) {
|
|
4536
|
-
return navigator.language;
|
|
4537
|
-
}
|
|
4538
|
-
} catch {
|
|
4539
|
-
}
|
|
4540
|
-
return null;
|
|
4541
|
-
}
|
|
4542
|
-
__name(detectLocale3, "detectLocale");
|
|
4543
|
-
var API3 = class {
|
|
4544
|
-
static {
|
|
4545
|
-
__name(this, "API");
|
|
4546
|
-
}
|
|
4547
|
-
baseUrl;
|
|
4548
|
-
storage;
|
|
4549
|
-
locale;
|
|
4550
|
-
apiKey;
|
|
4551
|
-
logger;
|
|
4552
|
-
cfg = Cfg3;
|
|
4553
|
-
totp = Totp;
|
|
4554
|
-
backupCodes = BackupCodes;
|
|
4555
|
-
totpManagement = TotpManagement;
|
|
4556
|
-
totpSetup = TotpSetup;
|
|
4557
|
-
totpVerification = TotpVerification;
|
|
4558
|
-
constructor(baseUrl2, opts = {}) {
|
|
4559
|
-
this.baseUrl = baseUrl2.replace(/\/$/, "");
|
|
4560
|
-
this.storage = opts.storage ?? new LocalStorageAdapter();
|
|
4561
|
-
this.logger = new APILogger(opts.logger);
|
|
4562
|
-
this.locale = opts.locale ?? null;
|
|
4563
|
-
this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
|
|
4564
|
-
const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
|
|
4565
|
-
client3.setConfig({ baseUrl: this.baseUrl, credentials });
|
|
4566
|
-
client3.interceptors.request.use((request) => {
|
|
4567
|
-
const access = this.getToken();
|
|
4568
|
-
if (access) request.headers.set("Authorization", `Bearer ${access}`);
|
|
4569
|
-
const locale = this.locale ?? detectLocale3();
|
|
4570
|
-
if (locale) request.headers.set("Accept-Language", locale);
|
|
4571
|
-
if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
|
|
4572
|
-
return request;
|
|
4573
|
-
});
|
|
4574
|
-
client3.interceptors.response.use(async (response, request) => {
|
|
4575
|
-
if (!response.ok) return response;
|
|
4576
|
-
const ct = response.headers.get("content-type") || "";
|
|
4577
|
-
if (!ct.includes("application/json")) return response;
|
|
4578
|
-
const url = new URL(request.url);
|
|
4579
|
-
const method = request.method.toUpperCase();
|
|
4580
|
-
const route = VALIDATION_ROUTES3.find(
|
|
4581
|
-
(r) => r.method === method && r.re.test(url.pathname)
|
|
4582
|
-
);
|
|
4583
|
-
if (!route) return response;
|
|
4584
|
-
let payload;
|
|
4585
|
-
try {
|
|
4586
|
-
payload = await response.clone().json();
|
|
4587
|
-
} catch {
|
|
4588
|
-
return response;
|
|
4589
|
-
}
|
|
4590
|
-
const result = route.schema.safeParse(payload);
|
|
4591
|
-
if (!result.success) {
|
|
4592
|
-
dispatchValidationError({
|
|
4593
|
-
operation: `${method} ${route.path}`,
|
|
4594
|
-
path: route.path,
|
|
4595
|
-
method,
|
|
4596
|
-
error: result.error,
|
|
4597
|
-
response: payload,
|
|
4598
|
-
timestamp: /* @__PURE__ */ new Date()
|
|
4599
|
-
});
|
|
4600
|
-
}
|
|
4601
|
-
return response;
|
|
4602
|
-
});
|
|
4603
|
-
}
|
|
4604
|
-
// ── Base URL ────────────────────────────────────────────────────────────
|
|
4605
|
-
getBaseUrl() {
|
|
4606
|
-
return this.baseUrl;
|
|
4607
|
-
}
|
|
4608
|
-
setBaseUrl(url) {
|
|
4609
|
-
this.baseUrl = url.replace(/\/$/, "");
|
|
4610
|
-
client3.setConfig({ baseUrl: this.baseUrl });
|
|
4611
|
-
}
|
|
4612
|
-
// ── Tokens ──────────────────────────────────────────────────────────────
|
|
4613
|
-
getToken() {
|
|
4614
|
-
return this.storage.getItem(ACCESS_KEY3);
|
|
4615
|
-
}
|
|
4616
|
-
setToken(token) {
|
|
4617
|
-
if (token) this.storage.setItem(ACCESS_KEY3, token);
|
|
4618
|
-
else this.storage.removeItem(ACCESS_KEY3);
|
|
4619
|
-
}
|
|
4620
|
-
getRefreshToken() {
|
|
4621
|
-
return this.storage.getItem(REFRESH_KEY3);
|
|
4622
|
-
}
|
|
4623
|
-
setRefreshToken(token) {
|
|
4624
|
-
if (token) this.storage.setItem(REFRESH_KEY3, token);
|
|
4625
|
-
else this.storage.removeItem(REFRESH_KEY3);
|
|
4626
|
-
}
|
|
4627
|
-
clearToken() {
|
|
4628
|
-
this.storage.removeItem(ACCESS_KEY3);
|
|
4629
|
-
this.storage.removeItem(REFRESH_KEY3);
|
|
4630
|
-
}
|
|
4631
|
-
isAuthenticated() {
|
|
4632
|
-
return this.getToken() !== null;
|
|
4633
|
-
}
|
|
4634
|
-
// ── Locale / API key ────────────────────────────────────────────────────
|
|
4635
|
-
getLocale() {
|
|
4636
|
-
return this.locale ?? detectLocale3();
|
|
4637
|
-
}
|
|
4638
|
-
setLocale(locale) {
|
|
4639
|
-
this.locale = locale;
|
|
4640
|
-
}
|
|
4641
|
-
getApiKey() {
|
|
4642
|
-
return this.apiKey;
|
|
4643
|
-
}
|
|
4644
|
-
setApiKey(key) {
|
|
4645
|
-
this.apiKey = key;
|
|
4646
|
-
}
|
|
4647
|
-
};
|
|
4648
|
-
|
|
4649
|
-
// src/_api/generated/index.ts
|
|
4650
|
-
var isStaticBuild = process.env.NEXT_PUBLIC_STATIC_BUILD === "true";
|
|
4651
|
-
var baseUrl = isStaticBuild ? "" : process.env.NEXT_PUBLIC_API_URL || "";
|
|
4652
|
-
var cfgAccountsApi = new API(baseUrl, { storage: new LocalStorageAdapter() });
|
|
4653
|
-
var cfgCentrifugoApi = new API2(baseUrl, { storage: new LocalStorageAdapter() });
|
|
4654
|
-
var cfgTotpApi = new API3(baseUrl, { storage: new LocalStorageAdapter() });
|
|
4655
2587
|
export {
|
|
4656
2588
|
APIError,
|
|
4657
2589
|
APILogger,
|
|
@@ -4660,9 +2592,13 @@ export {
|
|
|
4660
2592
|
BackupCodes,
|
|
4661
2593
|
Centrifugo,
|
|
4662
2594
|
CentrifugoAuth,
|
|
2595
|
+
Cfg,
|
|
4663
2596
|
API as CfgAccountsAPI,
|
|
2597
|
+
CfgAccountsApi,
|
|
4664
2598
|
API2 as CfgCentrifugoAPI,
|
|
2599
|
+
CfgCentrifugoApi,
|
|
4665
2600
|
API3 as CfgTotpAPI,
|
|
2601
|
+
CfgTotpApi,
|
|
4666
2602
|
CookieStorageAdapter,
|
|
4667
2603
|
LocalStorageAdapter,
|
|
4668
2604
|
MemoryStorageAdapter,
|
|
@@ -4673,10 +2609,7 @@ export {
|
|
|
4673
2609
|
TotpSetup,
|
|
4674
2610
|
TotpVerification,
|
|
4675
2611
|
UserProfile,
|
|
4676
|
-
|
|
4677
|
-
cfgAccountsApi,
|
|
4678
|
-
cfgCentrifugoApi,
|
|
4679
|
-
cfgTotpApi,
|
|
2612
|
+
CfgAccountsApi as api,
|
|
4680
2613
|
defaultLogger,
|
|
4681
2614
|
dispatchValidationError,
|
|
4682
2615
|
formatZodError,
|