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