@djangocfg/api 2.1.355 → 2.1.357
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/README.md +53 -632
- package/dist/auth-server.cjs +717 -200
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +717 -200
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +843 -783
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +58 -37
- package/dist/auth.d.ts +58 -37
- package/dist/auth.mjs +846 -784
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +1427 -0
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +1686 -0
- package/dist/clients.d.ts +1686 -0
- package/dist/clients.mjs +1427 -0
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +1277 -1924
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +18 -1206
- package/dist/hooks.d.ts +18 -1206
- package/dist/hooks.mjs +1253 -1900
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +545 -1232
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1389 -1455
- package/dist/index.d.ts +1389 -1455
- package/dist/index.mjs +545 -1232
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -2
- package/src/_api/generated/_cfg_accounts/api.ts +11 -3
- package/src/_api/generated/_cfg_accounts/hooks/index.ts +3 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRegenerateCreate.ts +64 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRetrieve.ts +65 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyTestCreate.ts +64 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthConnectionsList.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthDisconnectCreate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGithubAuthorizeCreate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGithubCallbackCreate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthProvidersRetrieve.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpRequestCreate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpVerifyCreate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileAvatarCreate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileDeleteCreate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialPartialUpdate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialUpdate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileRetrieve.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdatePartialUpdate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdateUpdate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsTokenRefreshCreate.ts +43 -3
- package/src/_api/generated/_cfg_accounts/index.ts +1 -1
- package/src/_api/generated/_cfg_accounts/schemas/APIKey.ts +13 -0
- package/src/_api/generated/_cfg_accounts/schemas/APIKeyRegenerate.ts +12 -0
- package/src/_api/generated/_cfg_accounts/schemas/APIKeyRequest.ts +13 -0
- package/src/_api/generated/{_cfg_totp/schemas/DeviceListStatusEnum.ts → _cfg_accounts/schemas/APIKeyTestRequest.ts} +4 -2
- package/src/_api/generated/_cfg_accounts/schemas/APIKeyTestResult.ts +12 -0
- package/src/_api/generated/_cfg_accounts/schemas/AccountDeleteResponse.ts +1 -1
- package/src/_api/generated/_cfg_accounts/schemas/CentrifugoToken.ts +2 -2
- package/src/_api/generated/_cfg_accounts/schemas/CfgUserUpdateRequest.ts +3 -2
- package/src/_api/generated/_cfg_accounts/schemas/OAuthCallbackRequestRequest.ts +1 -1
- package/src/_api/generated/_cfg_accounts/schemas/OAuthConnection.ts +6 -6
- package/src/_api/generated/_cfg_accounts/schemas/OAuthDisconnectRequestRequest.ts +2 -2
- package/src/_api/generated/_cfg_accounts/schemas/{ProviderEnum.ts → OAuthProviderEnum.ts} +2 -2
- package/src/_api/generated/_cfg_accounts/schemas/OAuthTokenResponse.ts +5 -5
- package/src/_api/generated/_cfg_accounts/schemas/OTPVerifyRequest.ts +1 -1
- package/src/_api/generated/_cfg_accounts/schemas/OTPVerifyResponse.ts +3 -3
- package/src/_api/generated/_cfg_accounts/schemas/PatchedCfgUserUpdateRequest.ts +3 -2
- package/src/_api/generated/_cfg_accounts/schemas/User.ts +12 -10
- package/src/_api/generated/_cfg_accounts/schemas/cfg_accounts_oauth_connections_response_200_AutoRef.ts +10 -0
- package/src/_api/generated/_cfg_accounts/schemas/cfg_accounts_oauth_disconnect_response_200_AutoRef.ts +11 -0
- package/src/_api/generated/_cfg_accounts/schemas/index.ts +8 -1
- package/src/_api/generated/_cfg_centrifugo/api.ts +3 -3
- package/src/_api/generated/_cfg_centrifugo/hooks/useCfgCentrifugoAuthTokenRetrieve.ts +43 -3
- package/src/_api/generated/_cfg_centrifugo/index.ts +1 -1
- package/src/_api/generated/_cfg_centrifugo/schemas/ConnectionTokenResponse.ts +2 -2
- package/src/_api/generated/_cfg_totp/api.ts +9 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpBackupCodesRegenerateCreate.ts +43 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpBackupCodesRetrieve.ts +43 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDevicesDestroy.ts +7 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDevicesRetrieve.ts +43 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDisableCreate.ts +43 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpSetupConfirmCreate.ts +43 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpSetupCreate.ts +43 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpVerifyBackupCreate.ts +43 -3
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpVerifyCreate.ts +43 -3
- package/src/_api/generated/_cfg_totp/index.ts +1 -1
- package/src/_api/generated/_cfg_totp/schemas/ConfirmSetupRequest.ts +1 -1
- package/src/_api/generated/_cfg_totp/schemas/ConfirmSetupResponse.ts +1 -1
- package/src/_api/generated/_cfg_totp/schemas/DeviceList.ts +5 -5
- package/src/_api/generated/_cfg_totp/schemas/DeviceStatusEnum.ts +9 -0
- package/src/_api/generated/_cfg_totp/schemas/SetupResponse.ts +2 -2
- package/src/_api/generated/_cfg_totp/schemas/TotpVerifyUser.ts +11 -9
- package/src/_api/generated/_cfg_totp/schemas/VerifyBackupRequest.ts +1 -1
- package/src/_api/generated/_cfg_totp/schemas/VerifyRequest.ts +1 -1
- package/src/_api/generated/_cfg_totp/schemas/VerifyResponse.ts +2 -2
- package/src/_api/generated/_cfg_totp/schemas/cfg_totp_disable_response_200_AutoRef.ts +9 -0
- package/src/_api/generated/_cfg_totp/schemas/index.ts +2 -1
- package/src/_api/generated/index.ts +3 -1
- package/src/_api/generated/sdk.gen.ts +80 -813
- package/src/_api/generated/types.gen.ts +320 -159
- package/src/auth/context/AccountsContext.tsx +18 -6
- package/src/auth/context/AuthContext.tsx +11 -3
- package/src/auth/hooks/useDeleteAccount.ts +2 -2
- package/src/auth/hooks/useGithubAuth.ts +3 -3
- package/src/auth/hooks/useTokenRefresh.ts +2 -2
- package/src/auth/hooks/useTwoFactor.ts +3 -3
- package/src/auth/hooks/useTwoFactorSetup.ts +3 -3
- package/src/auth/hooks/useTwoFactorStatus.ts +3 -3
- package/src/auth/middlewares/tokenRefresh.ts +2 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useApiKey.ts +73 -0
- package/src/index.ts +12 -16
package/dist/clients.mjs
CHANGED
|
@@ -95,6 +95,8 @@ var _baseUrlOverride = null;
|
|
|
95
95
|
var _withCredentials = true;
|
|
96
96
|
var _onUnauthorized = null;
|
|
97
97
|
var _refreshHandler = null;
|
|
98
|
+
var _refreshInflight = null;
|
|
99
|
+
var RETRY_MARKER = "X-Auth-Retry";
|
|
98
100
|
var _client = null;
|
|
99
101
|
function pushClientConfig() {
|
|
100
102
|
if (!_client) return;
|
|
@@ -199,6 +201,94 @@ var auth = {
|
|
|
199
201
|
_refreshHandler = fn;
|
|
200
202
|
}
|
|
201
203
|
};
|
|
204
|
+
async function tryRefresh() {
|
|
205
|
+
if (_refreshInflight) return _refreshInflight;
|
|
206
|
+
if (!_refreshHandler) return null;
|
|
207
|
+
const refresh = auth.getRefreshToken();
|
|
208
|
+
if (!refresh) return null;
|
|
209
|
+
_refreshInflight = (async () => {
|
|
210
|
+
try {
|
|
211
|
+
const result = await _refreshHandler(refresh);
|
|
212
|
+
if (!result?.access) return null;
|
|
213
|
+
auth.setToken(result.access);
|
|
214
|
+
if (result.refresh) auth.setRefreshToken(result.refresh);
|
|
215
|
+
return result.access;
|
|
216
|
+
} catch {
|
|
217
|
+
return null;
|
|
218
|
+
} finally {
|
|
219
|
+
_refreshInflight = null;
|
|
220
|
+
}
|
|
221
|
+
})();
|
|
222
|
+
return _refreshInflight;
|
|
223
|
+
}
|
|
224
|
+
__name(tryRefresh, "tryRefresh");
|
|
225
|
+
function installAuthOnClient(client2) {
|
|
226
|
+
if (_client) return;
|
|
227
|
+
_client = client2;
|
|
228
|
+
client2.setConfig({
|
|
229
|
+
baseUrl: auth.getBaseUrl(),
|
|
230
|
+
credentials: _withCredentials ? "include" : "same-origin"
|
|
231
|
+
});
|
|
232
|
+
client2.interceptors.request.use((request) => {
|
|
233
|
+
const token = auth.getToken();
|
|
234
|
+
if (token) request.headers.set("Authorization", `Bearer ${token}`);
|
|
235
|
+
const locale = auth.getLocale();
|
|
236
|
+
if (locale) request.headers.set("Accept-Language", locale);
|
|
237
|
+
const apiKey = auth.getApiKey();
|
|
238
|
+
if (apiKey) request.headers.set("X-API-Key", apiKey);
|
|
239
|
+
try {
|
|
240
|
+
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
241
|
+
if (tz) request.headers.set("X-Timezone", tz);
|
|
242
|
+
} catch {
|
|
243
|
+
}
|
|
244
|
+
request.headers.set("X-Client-Time", (/* @__PURE__ */ new Date()).toISOString());
|
|
245
|
+
return request;
|
|
246
|
+
});
|
|
247
|
+
client2.interceptors.response.use(async (response, request) => {
|
|
248
|
+
if (response.status !== 401) return response;
|
|
249
|
+
if (request.headers.get(RETRY_MARKER)) {
|
|
250
|
+
if (_onUnauthorized) {
|
|
251
|
+
try {
|
|
252
|
+
_onUnauthorized(response);
|
|
253
|
+
} catch {
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return response;
|
|
257
|
+
}
|
|
258
|
+
const newToken = await tryRefresh();
|
|
259
|
+
if (!newToken) {
|
|
260
|
+
if (_onUnauthorized) {
|
|
261
|
+
try {
|
|
262
|
+
_onUnauthorized(response);
|
|
263
|
+
} catch {
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return response;
|
|
267
|
+
}
|
|
268
|
+
const retry = request.clone();
|
|
269
|
+
retry.headers.set("Authorization", `Bearer ${newToken}`);
|
|
270
|
+
retry.headers.set(RETRY_MARKER, "1");
|
|
271
|
+
try {
|
|
272
|
+
const retried = await fetch(retry);
|
|
273
|
+
if (retried.status === 401 && _onUnauthorized) {
|
|
274
|
+
try {
|
|
275
|
+
_onUnauthorized(retried);
|
|
276
|
+
} catch {
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return retried;
|
|
280
|
+
} catch {
|
|
281
|
+
if (_onUnauthorized) {
|
|
282
|
+
try {
|
|
283
|
+
_onUnauthorized(response);
|
|
284
|
+
} catch {
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return response;
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
__name(installAuthOnClient, "installAuthOnClient");
|
|
202
292
|
|
|
203
293
|
// src/_api/generated/helpers/logger.ts
|
|
204
294
|
import { createConsola } from "consola";
|
|
@@ -294,12 +384,1344 @@ var APILogger = class {
|
|
|
294
384
|
};
|
|
295
385
|
var defaultLogger = new APILogger();
|
|
296
386
|
|
|
387
|
+
// src/_api/generated/core/bodySerializer.gen.ts
|
|
388
|
+
var serializeFormDataPair = /* @__PURE__ */ __name((data, key, value) => {
|
|
389
|
+
if (typeof value === "string" || value instanceof Blob) {
|
|
390
|
+
data.append(key, value);
|
|
391
|
+
} else if (value instanceof Date) {
|
|
392
|
+
data.append(key, value.toISOString());
|
|
393
|
+
} else {
|
|
394
|
+
data.append(key, JSON.stringify(value));
|
|
395
|
+
}
|
|
396
|
+
}, "serializeFormDataPair");
|
|
397
|
+
var formDataBodySerializer = {
|
|
398
|
+
bodySerializer: /* @__PURE__ */ __name((body) => {
|
|
399
|
+
const data = new FormData();
|
|
400
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
401
|
+
if (value === void 0 || value === null) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
if (Array.isArray(value)) {
|
|
405
|
+
value.forEach((v) => serializeFormDataPair(data, key, v));
|
|
406
|
+
} else {
|
|
407
|
+
serializeFormDataPair(data, key, value);
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
return data;
|
|
411
|
+
}, "bodySerializer")
|
|
412
|
+
};
|
|
413
|
+
var jsonBodySerializer = {
|
|
414
|
+
bodySerializer: /* @__PURE__ */ __name((body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value), "bodySerializer")
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
// src/_api/generated/core/params.gen.ts
|
|
418
|
+
var extraPrefixesMap = {
|
|
419
|
+
$body_: "body",
|
|
420
|
+
$headers_: "headers",
|
|
421
|
+
$path_: "path",
|
|
422
|
+
$query_: "query"
|
|
423
|
+
};
|
|
424
|
+
var extraPrefixes = Object.entries(extraPrefixesMap);
|
|
425
|
+
|
|
426
|
+
// src/_api/generated/core/serverSentEvents.gen.ts
|
|
427
|
+
function createSseClient({
|
|
428
|
+
onRequest,
|
|
429
|
+
onSseError,
|
|
430
|
+
onSseEvent,
|
|
431
|
+
responseTransformer,
|
|
432
|
+
responseValidator,
|
|
433
|
+
sseDefaultRetryDelay,
|
|
434
|
+
sseMaxRetryAttempts,
|
|
435
|
+
sseMaxRetryDelay,
|
|
436
|
+
sseSleepFn,
|
|
437
|
+
url,
|
|
438
|
+
...options
|
|
439
|
+
}) {
|
|
440
|
+
let lastEventId;
|
|
441
|
+
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
442
|
+
const createStream = /* @__PURE__ */ __name(async function* () {
|
|
443
|
+
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
444
|
+
let attempt = 0;
|
|
445
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
446
|
+
while (true) {
|
|
447
|
+
if (signal.aborted) break;
|
|
448
|
+
attempt++;
|
|
449
|
+
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
450
|
+
if (lastEventId !== void 0) {
|
|
451
|
+
headers.set("Last-Event-ID", lastEventId);
|
|
452
|
+
}
|
|
453
|
+
try {
|
|
454
|
+
const requestInit = {
|
|
455
|
+
redirect: "follow",
|
|
456
|
+
...options,
|
|
457
|
+
body: options.serializedBody,
|
|
458
|
+
headers,
|
|
459
|
+
signal
|
|
460
|
+
};
|
|
461
|
+
let request = new Request(url, requestInit);
|
|
462
|
+
if (onRequest) {
|
|
463
|
+
request = await onRequest(url, requestInit);
|
|
464
|
+
}
|
|
465
|
+
const _fetch = options.fetch ?? globalThis.fetch;
|
|
466
|
+
const response = await _fetch(request);
|
|
467
|
+
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
468
|
+
if (!response.body) throw new Error("No body in SSE response");
|
|
469
|
+
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
470
|
+
let buffer = "";
|
|
471
|
+
const abortHandler = /* @__PURE__ */ __name(() => {
|
|
472
|
+
try {
|
|
473
|
+
reader.cancel();
|
|
474
|
+
} catch {
|
|
475
|
+
}
|
|
476
|
+
}, "abortHandler");
|
|
477
|
+
signal.addEventListener("abort", abortHandler);
|
|
478
|
+
try {
|
|
479
|
+
while (true) {
|
|
480
|
+
const { done, value } = await reader.read();
|
|
481
|
+
if (done) break;
|
|
482
|
+
buffer += value;
|
|
483
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
484
|
+
const chunks = buffer.split("\n\n");
|
|
485
|
+
buffer = chunks.pop() ?? "";
|
|
486
|
+
for (const chunk of chunks) {
|
|
487
|
+
const lines = chunk.split("\n");
|
|
488
|
+
const dataLines = [];
|
|
489
|
+
let eventName;
|
|
490
|
+
for (const line of lines) {
|
|
491
|
+
if (line.startsWith("data:")) {
|
|
492
|
+
dataLines.push(line.replace(/^data:\s*/, ""));
|
|
493
|
+
} else if (line.startsWith("event:")) {
|
|
494
|
+
eventName = line.replace(/^event:\s*/, "");
|
|
495
|
+
} else if (line.startsWith("id:")) {
|
|
496
|
+
lastEventId = line.replace(/^id:\s*/, "");
|
|
497
|
+
} else if (line.startsWith("retry:")) {
|
|
498
|
+
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
|
499
|
+
if (!Number.isNaN(parsed)) {
|
|
500
|
+
retryDelay = parsed;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
let data;
|
|
505
|
+
let parsedJson = false;
|
|
506
|
+
if (dataLines.length) {
|
|
507
|
+
const rawData = dataLines.join("\n");
|
|
508
|
+
try {
|
|
509
|
+
data = JSON.parse(rawData);
|
|
510
|
+
parsedJson = true;
|
|
511
|
+
} catch {
|
|
512
|
+
data = rawData;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
if (parsedJson) {
|
|
516
|
+
if (responseValidator) {
|
|
517
|
+
await responseValidator(data);
|
|
518
|
+
}
|
|
519
|
+
if (responseTransformer) {
|
|
520
|
+
data = await responseTransformer(data);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
onSseEvent?.({
|
|
524
|
+
data,
|
|
525
|
+
event: eventName,
|
|
526
|
+
id: lastEventId,
|
|
527
|
+
retry: retryDelay
|
|
528
|
+
});
|
|
529
|
+
if (dataLines.length) {
|
|
530
|
+
yield data;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
} finally {
|
|
535
|
+
signal.removeEventListener("abort", abortHandler);
|
|
536
|
+
reader.releaseLock();
|
|
537
|
+
}
|
|
538
|
+
break;
|
|
539
|
+
} catch (error) {
|
|
540
|
+
onSseError?.(error);
|
|
541
|
+
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
|
|
542
|
+
break;
|
|
543
|
+
}
|
|
544
|
+
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
|
|
545
|
+
await sleep(backoff);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}, "createStream");
|
|
549
|
+
const stream = createStream();
|
|
550
|
+
return { stream };
|
|
551
|
+
}
|
|
552
|
+
__name(createSseClient, "createSseClient");
|
|
553
|
+
|
|
554
|
+
// src/_api/generated/core/pathSerializer.gen.ts
|
|
555
|
+
var separatorArrayExplode = /* @__PURE__ */ __name((style) => {
|
|
556
|
+
switch (style) {
|
|
557
|
+
case "label":
|
|
558
|
+
return ".";
|
|
559
|
+
case "matrix":
|
|
560
|
+
return ";";
|
|
561
|
+
case "simple":
|
|
562
|
+
return ",";
|
|
563
|
+
default:
|
|
564
|
+
return "&";
|
|
565
|
+
}
|
|
566
|
+
}, "separatorArrayExplode");
|
|
567
|
+
var separatorArrayNoExplode = /* @__PURE__ */ __name((style) => {
|
|
568
|
+
switch (style) {
|
|
569
|
+
case "form":
|
|
570
|
+
return ",";
|
|
571
|
+
case "pipeDelimited":
|
|
572
|
+
return "|";
|
|
573
|
+
case "spaceDelimited":
|
|
574
|
+
return "%20";
|
|
575
|
+
default:
|
|
576
|
+
return ",";
|
|
577
|
+
}
|
|
578
|
+
}, "separatorArrayNoExplode");
|
|
579
|
+
var separatorObjectExplode = /* @__PURE__ */ __name((style) => {
|
|
580
|
+
switch (style) {
|
|
581
|
+
case "label":
|
|
582
|
+
return ".";
|
|
583
|
+
case "matrix":
|
|
584
|
+
return ";";
|
|
585
|
+
case "simple":
|
|
586
|
+
return ",";
|
|
587
|
+
default:
|
|
588
|
+
return "&";
|
|
589
|
+
}
|
|
590
|
+
}, "separatorObjectExplode");
|
|
591
|
+
var serializeArrayParam = /* @__PURE__ */ __name(({
|
|
592
|
+
allowReserved,
|
|
593
|
+
explode,
|
|
594
|
+
name,
|
|
595
|
+
style,
|
|
596
|
+
value
|
|
597
|
+
}) => {
|
|
598
|
+
if (!explode) {
|
|
599
|
+
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
600
|
+
switch (style) {
|
|
601
|
+
case "label":
|
|
602
|
+
return `.${joinedValues2}`;
|
|
603
|
+
case "matrix":
|
|
604
|
+
return `;${name}=${joinedValues2}`;
|
|
605
|
+
case "simple":
|
|
606
|
+
return joinedValues2;
|
|
607
|
+
default:
|
|
608
|
+
return `${name}=${joinedValues2}`;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
const separator = separatorArrayExplode(style);
|
|
612
|
+
const joinedValues = value.map((v) => {
|
|
613
|
+
if (style === "label" || style === "simple") {
|
|
614
|
+
return allowReserved ? v : encodeURIComponent(v);
|
|
615
|
+
}
|
|
616
|
+
return serializePrimitiveParam({
|
|
617
|
+
allowReserved,
|
|
618
|
+
name,
|
|
619
|
+
value: v
|
|
620
|
+
});
|
|
621
|
+
}).join(separator);
|
|
622
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
623
|
+
}, "serializeArrayParam");
|
|
624
|
+
var serializePrimitiveParam = /* @__PURE__ */ __name(({
|
|
625
|
+
allowReserved,
|
|
626
|
+
name,
|
|
627
|
+
value
|
|
628
|
+
}) => {
|
|
629
|
+
if (value === void 0 || value === null) {
|
|
630
|
+
return "";
|
|
631
|
+
}
|
|
632
|
+
if (typeof value === "object") {
|
|
633
|
+
throw new Error(
|
|
634
|
+
"Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
638
|
+
}, "serializePrimitiveParam");
|
|
639
|
+
var serializeObjectParam = /* @__PURE__ */ __name(({
|
|
640
|
+
allowReserved,
|
|
641
|
+
explode,
|
|
642
|
+
name,
|
|
643
|
+
style,
|
|
644
|
+
value,
|
|
645
|
+
valueOnly
|
|
646
|
+
}) => {
|
|
647
|
+
if (value instanceof Date) {
|
|
648
|
+
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
649
|
+
}
|
|
650
|
+
if (style !== "deepObject" && !explode) {
|
|
651
|
+
let values = [];
|
|
652
|
+
Object.entries(value).forEach(([key, v]) => {
|
|
653
|
+
values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
|
|
654
|
+
});
|
|
655
|
+
const joinedValues2 = values.join(",");
|
|
656
|
+
switch (style) {
|
|
657
|
+
case "form":
|
|
658
|
+
return `${name}=${joinedValues2}`;
|
|
659
|
+
case "label":
|
|
660
|
+
return `.${joinedValues2}`;
|
|
661
|
+
case "matrix":
|
|
662
|
+
return `;${name}=${joinedValues2}`;
|
|
663
|
+
default:
|
|
664
|
+
return joinedValues2;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
const separator = separatorObjectExplode(style);
|
|
668
|
+
const joinedValues = Object.entries(value).map(
|
|
669
|
+
([key, v]) => serializePrimitiveParam({
|
|
670
|
+
allowReserved,
|
|
671
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
672
|
+
value: v
|
|
673
|
+
})
|
|
674
|
+
).join(separator);
|
|
675
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
676
|
+
}, "serializeObjectParam");
|
|
677
|
+
|
|
678
|
+
// src/_api/generated/core/utils.gen.ts
|
|
679
|
+
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
680
|
+
var defaultPathSerializer = /* @__PURE__ */ __name(({ path, url: _url }) => {
|
|
681
|
+
let url = _url;
|
|
682
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
683
|
+
if (matches) {
|
|
684
|
+
for (const match of matches) {
|
|
685
|
+
let explode = false;
|
|
686
|
+
let name = match.substring(1, match.length - 1);
|
|
687
|
+
let style = "simple";
|
|
688
|
+
if (name.endsWith("*")) {
|
|
689
|
+
explode = true;
|
|
690
|
+
name = name.substring(0, name.length - 1);
|
|
691
|
+
}
|
|
692
|
+
if (name.startsWith(".")) {
|
|
693
|
+
name = name.substring(1);
|
|
694
|
+
style = "label";
|
|
695
|
+
} else if (name.startsWith(";")) {
|
|
696
|
+
name = name.substring(1);
|
|
697
|
+
style = "matrix";
|
|
698
|
+
}
|
|
699
|
+
const value = path[name];
|
|
700
|
+
if (value === void 0 || value === null) {
|
|
701
|
+
continue;
|
|
702
|
+
}
|
|
703
|
+
if (Array.isArray(value)) {
|
|
704
|
+
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
705
|
+
continue;
|
|
706
|
+
}
|
|
707
|
+
if (typeof value === "object") {
|
|
708
|
+
url = url.replace(
|
|
709
|
+
match,
|
|
710
|
+
serializeObjectParam({
|
|
711
|
+
explode,
|
|
712
|
+
name,
|
|
713
|
+
style,
|
|
714
|
+
value,
|
|
715
|
+
valueOnly: true
|
|
716
|
+
})
|
|
717
|
+
);
|
|
718
|
+
continue;
|
|
719
|
+
}
|
|
720
|
+
if (style === "matrix") {
|
|
721
|
+
url = url.replace(
|
|
722
|
+
match,
|
|
723
|
+
`;${serializePrimitiveParam({
|
|
724
|
+
name,
|
|
725
|
+
value
|
|
726
|
+
})}`
|
|
727
|
+
);
|
|
728
|
+
continue;
|
|
729
|
+
}
|
|
730
|
+
const replaceValue = encodeURIComponent(
|
|
731
|
+
style === "label" ? `.${value}` : value
|
|
732
|
+
);
|
|
733
|
+
url = url.replace(match, replaceValue);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
return url;
|
|
737
|
+
}, "defaultPathSerializer");
|
|
738
|
+
var getUrl = /* @__PURE__ */ __name(({
|
|
739
|
+
baseUrl,
|
|
740
|
+
path,
|
|
741
|
+
query,
|
|
742
|
+
querySerializer,
|
|
743
|
+
url: _url
|
|
744
|
+
}) => {
|
|
745
|
+
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
746
|
+
let url = (baseUrl ?? "") + pathUrl;
|
|
747
|
+
if (path) {
|
|
748
|
+
url = defaultPathSerializer({ path, url });
|
|
749
|
+
}
|
|
750
|
+
let search = query ? querySerializer(query) : "";
|
|
751
|
+
if (search.startsWith("?")) {
|
|
752
|
+
search = search.substring(1);
|
|
753
|
+
}
|
|
754
|
+
if (search) {
|
|
755
|
+
url += `?${search}`;
|
|
756
|
+
}
|
|
757
|
+
return url;
|
|
758
|
+
}, "getUrl");
|
|
759
|
+
function getValidRequestBody(options) {
|
|
760
|
+
const hasBody = options.body !== void 0;
|
|
761
|
+
const isSerializedBody = hasBody && options.bodySerializer;
|
|
762
|
+
if (isSerializedBody) {
|
|
763
|
+
if ("serializedBody" in options) {
|
|
764
|
+
const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
|
|
765
|
+
return hasSerializedBody ? options.serializedBody : null;
|
|
766
|
+
}
|
|
767
|
+
return options.body !== "" ? options.body : null;
|
|
768
|
+
}
|
|
769
|
+
if (hasBody) {
|
|
770
|
+
return options.body;
|
|
771
|
+
}
|
|
772
|
+
return void 0;
|
|
773
|
+
}
|
|
774
|
+
__name(getValidRequestBody, "getValidRequestBody");
|
|
775
|
+
|
|
776
|
+
// src/_api/generated/core/auth.gen.ts
|
|
777
|
+
var getAuthToken = /* @__PURE__ */ __name(async (auth2, callback) => {
|
|
778
|
+
const token = typeof callback === "function" ? await callback(auth2) : callback;
|
|
779
|
+
if (!token) {
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
if (auth2.scheme === "bearer") {
|
|
783
|
+
return `Bearer ${token}`;
|
|
784
|
+
}
|
|
785
|
+
if (auth2.scheme === "basic") {
|
|
786
|
+
return `Basic ${btoa(token)}`;
|
|
787
|
+
}
|
|
788
|
+
return token;
|
|
789
|
+
}, "getAuthToken");
|
|
790
|
+
|
|
791
|
+
// src/_api/generated/client/utils.gen.ts
|
|
792
|
+
var createQuerySerializer = /* @__PURE__ */ __name(({
|
|
793
|
+
parameters = {},
|
|
794
|
+
...args
|
|
795
|
+
} = {}) => {
|
|
796
|
+
const querySerializer = /* @__PURE__ */ __name((queryParams) => {
|
|
797
|
+
const search = [];
|
|
798
|
+
if (queryParams && typeof queryParams === "object") {
|
|
799
|
+
for (const name in queryParams) {
|
|
800
|
+
const value = queryParams[name];
|
|
801
|
+
if (value === void 0 || value === null) {
|
|
802
|
+
continue;
|
|
803
|
+
}
|
|
804
|
+
const options = parameters[name] || args;
|
|
805
|
+
if (Array.isArray(value)) {
|
|
806
|
+
const serializedArray = serializeArrayParam({
|
|
807
|
+
allowReserved: options.allowReserved,
|
|
808
|
+
explode: true,
|
|
809
|
+
name,
|
|
810
|
+
style: "form",
|
|
811
|
+
value,
|
|
812
|
+
...options.array
|
|
813
|
+
});
|
|
814
|
+
if (serializedArray) search.push(serializedArray);
|
|
815
|
+
} else if (typeof value === "object") {
|
|
816
|
+
const serializedObject = serializeObjectParam({
|
|
817
|
+
allowReserved: options.allowReserved,
|
|
818
|
+
explode: true,
|
|
819
|
+
name,
|
|
820
|
+
style: "deepObject",
|
|
821
|
+
value,
|
|
822
|
+
...options.object
|
|
823
|
+
});
|
|
824
|
+
if (serializedObject) search.push(serializedObject);
|
|
825
|
+
} else {
|
|
826
|
+
const serializedPrimitive = serializePrimitiveParam({
|
|
827
|
+
allowReserved: options.allowReserved,
|
|
828
|
+
name,
|
|
829
|
+
value
|
|
830
|
+
});
|
|
831
|
+
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
return search.join("&");
|
|
836
|
+
}, "querySerializer");
|
|
837
|
+
return querySerializer;
|
|
838
|
+
}, "createQuerySerializer");
|
|
839
|
+
var getParseAs = /* @__PURE__ */ __name((contentType) => {
|
|
840
|
+
if (!contentType) {
|
|
841
|
+
return "stream";
|
|
842
|
+
}
|
|
843
|
+
const cleanContent = contentType.split(";")[0]?.trim();
|
|
844
|
+
if (!cleanContent) {
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
|
848
|
+
return "json";
|
|
849
|
+
}
|
|
850
|
+
if (cleanContent === "multipart/form-data") {
|
|
851
|
+
return "formData";
|
|
852
|
+
}
|
|
853
|
+
if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
|
|
854
|
+
return "blob";
|
|
855
|
+
}
|
|
856
|
+
if (cleanContent.startsWith("text/")) {
|
|
857
|
+
return "text";
|
|
858
|
+
}
|
|
859
|
+
return;
|
|
860
|
+
}, "getParseAs");
|
|
861
|
+
var checkForExistence = /* @__PURE__ */ __name((options, name) => {
|
|
862
|
+
if (!name) {
|
|
863
|
+
return false;
|
|
864
|
+
}
|
|
865
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
866
|
+
return true;
|
|
867
|
+
}
|
|
868
|
+
return false;
|
|
869
|
+
}, "checkForExistence");
|
|
870
|
+
var setAuthParams = /* @__PURE__ */ __name(async ({
|
|
871
|
+
security,
|
|
872
|
+
...options
|
|
873
|
+
}) => {
|
|
874
|
+
for (const auth2 of security) {
|
|
875
|
+
if (checkForExistence(options, auth2.name)) {
|
|
876
|
+
continue;
|
|
877
|
+
}
|
|
878
|
+
const token = await getAuthToken(auth2, options.auth);
|
|
879
|
+
if (!token) {
|
|
880
|
+
continue;
|
|
881
|
+
}
|
|
882
|
+
const name = auth2.name ?? "Authorization";
|
|
883
|
+
switch (auth2.in) {
|
|
884
|
+
case "query":
|
|
885
|
+
if (!options.query) {
|
|
886
|
+
options.query = {};
|
|
887
|
+
}
|
|
888
|
+
options.query[name] = token;
|
|
889
|
+
break;
|
|
890
|
+
case "cookie":
|
|
891
|
+
options.headers.append("Cookie", `${name}=${token}`);
|
|
892
|
+
break;
|
|
893
|
+
case "header":
|
|
894
|
+
default:
|
|
895
|
+
options.headers.set(name, token);
|
|
896
|
+
break;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
}, "setAuthParams");
|
|
900
|
+
var buildUrl = /* @__PURE__ */ __name((options) => getUrl({
|
|
901
|
+
baseUrl: options.baseUrl,
|
|
902
|
+
path: options.path,
|
|
903
|
+
query: options.query,
|
|
904
|
+
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
905
|
+
url: options.url
|
|
906
|
+
}), "buildUrl");
|
|
907
|
+
var mergeConfigs = /* @__PURE__ */ __name((a, b) => {
|
|
908
|
+
const config = { ...a, ...b };
|
|
909
|
+
if (config.baseUrl?.endsWith("/")) {
|
|
910
|
+
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
911
|
+
}
|
|
912
|
+
config.headers = mergeHeaders(a.headers, b.headers);
|
|
913
|
+
return config;
|
|
914
|
+
}, "mergeConfigs");
|
|
915
|
+
var headersEntries = /* @__PURE__ */ __name((headers) => {
|
|
916
|
+
const entries = [];
|
|
917
|
+
headers.forEach((value, key) => {
|
|
918
|
+
entries.push([key, value]);
|
|
919
|
+
});
|
|
920
|
+
return entries;
|
|
921
|
+
}, "headersEntries");
|
|
922
|
+
var mergeHeaders = /* @__PURE__ */ __name((...headers) => {
|
|
923
|
+
const mergedHeaders = new Headers();
|
|
924
|
+
for (const header of headers) {
|
|
925
|
+
if (!header) {
|
|
926
|
+
continue;
|
|
927
|
+
}
|
|
928
|
+
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
929
|
+
for (const [key, value] of iterator) {
|
|
930
|
+
if (value === null) {
|
|
931
|
+
mergedHeaders.delete(key);
|
|
932
|
+
} else if (Array.isArray(value)) {
|
|
933
|
+
for (const v of value) {
|
|
934
|
+
mergedHeaders.append(key, v);
|
|
935
|
+
}
|
|
936
|
+
} else if (value !== void 0) {
|
|
937
|
+
mergedHeaders.set(
|
|
938
|
+
key,
|
|
939
|
+
typeof value === "object" ? JSON.stringify(value) : value
|
|
940
|
+
);
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
return mergedHeaders;
|
|
945
|
+
}, "mergeHeaders");
|
|
946
|
+
var Interceptors = class {
|
|
947
|
+
static {
|
|
948
|
+
__name(this, "Interceptors");
|
|
949
|
+
}
|
|
950
|
+
fns = [];
|
|
951
|
+
clear() {
|
|
952
|
+
this.fns = [];
|
|
953
|
+
}
|
|
954
|
+
eject(id) {
|
|
955
|
+
const index = this.getInterceptorIndex(id);
|
|
956
|
+
if (this.fns[index]) {
|
|
957
|
+
this.fns[index] = null;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
exists(id) {
|
|
961
|
+
const index = this.getInterceptorIndex(id);
|
|
962
|
+
return Boolean(this.fns[index]);
|
|
963
|
+
}
|
|
964
|
+
getInterceptorIndex(id) {
|
|
965
|
+
if (typeof id === "number") {
|
|
966
|
+
return this.fns[id] ? id : -1;
|
|
967
|
+
}
|
|
968
|
+
return this.fns.indexOf(id);
|
|
969
|
+
}
|
|
970
|
+
update(id, fn) {
|
|
971
|
+
const index = this.getInterceptorIndex(id);
|
|
972
|
+
if (this.fns[index]) {
|
|
973
|
+
this.fns[index] = fn;
|
|
974
|
+
return id;
|
|
975
|
+
}
|
|
976
|
+
return false;
|
|
977
|
+
}
|
|
978
|
+
use(fn) {
|
|
979
|
+
this.fns.push(fn);
|
|
980
|
+
return this.fns.length - 1;
|
|
981
|
+
}
|
|
982
|
+
};
|
|
983
|
+
var createInterceptors = /* @__PURE__ */ __name(() => ({
|
|
984
|
+
error: new Interceptors(),
|
|
985
|
+
request: new Interceptors(),
|
|
986
|
+
response: new Interceptors()
|
|
987
|
+
}), "createInterceptors");
|
|
988
|
+
var defaultQuerySerializer = createQuerySerializer({
|
|
989
|
+
allowReserved: false,
|
|
990
|
+
array: {
|
|
991
|
+
explode: true,
|
|
992
|
+
style: "form"
|
|
993
|
+
},
|
|
994
|
+
object: {
|
|
995
|
+
explode: true,
|
|
996
|
+
style: "deepObject"
|
|
997
|
+
}
|
|
998
|
+
});
|
|
999
|
+
var defaultHeaders = {
|
|
1000
|
+
"Content-Type": "application/json"
|
|
1001
|
+
};
|
|
1002
|
+
var createConfig = /* @__PURE__ */ __name((override = {}) => ({
|
|
1003
|
+
...jsonBodySerializer,
|
|
1004
|
+
headers: defaultHeaders,
|
|
1005
|
+
parseAs: "auto",
|
|
1006
|
+
querySerializer: defaultQuerySerializer,
|
|
1007
|
+
...override
|
|
1008
|
+
}), "createConfig");
|
|
1009
|
+
|
|
1010
|
+
// src/_api/generated/client/client.gen.ts
|
|
1011
|
+
var createClient = /* @__PURE__ */ __name((config = {}) => {
|
|
1012
|
+
let _config = mergeConfigs(createConfig(), config);
|
|
1013
|
+
const getConfig = /* @__PURE__ */ __name(() => ({ ..._config }), "getConfig");
|
|
1014
|
+
const setConfig = /* @__PURE__ */ __name((config2) => {
|
|
1015
|
+
_config = mergeConfigs(_config, config2);
|
|
1016
|
+
return getConfig();
|
|
1017
|
+
}, "setConfig");
|
|
1018
|
+
const interceptors = createInterceptors();
|
|
1019
|
+
const beforeRequest = /* @__PURE__ */ __name(async (options) => {
|
|
1020
|
+
const opts = {
|
|
1021
|
+
..._config,
|
|
1022
|
+
...options,
|
|
1023
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
1024
|
+
headers: mergeHeaders(_config.headers, options.headers),
|
|
1025
|
+
serializedBody: void 0
|
|
1026
|
+
};
|
|
1027
|
+
if (opts.security) {
|
|
1028
|
+
await setAuthParams({
|
|
1029
|
+
...opts,
|
|
1030
|
+
security: opts.security
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
if (opts.requestValidator) {
|
|
1034
|
+
await opts.requestValidator(opts);
|
|
1035
|
+
}
|
|
1036
|
+
if (opts.body !== void 0 && opts.bodySerializer) {
|
|
1037
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
1038
|
+
}
|
|
1039
|
+
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
1040
|
+
opts.headers.delete("Content-Type");
|
|
1041
|
+
}
|
|
1042
|
+
const resolvedOpts = opts;
|
|
1043
|
+
const url = buildUrl(resolvedOpts);
|
|
1044
|
+
return { opts: resolvedOpts, url };
|
|
1045
|
+
}, "beforeRequest");
|
|
1046
|
+
const request = /* @__PURE__ */ __name(async (options) => {
|
|
1047
|
+
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
1048
|
+
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
1049
|
+
let request2;
|
|
1050
|
+
let response;
|
|
1051
|
+
try {
|
|
1052
|
+
const { opts, url } = await beforeRequest(options);
|
|
1053
|
+
const requestInit = {
|
|
1054
|
+
redirect: "follow",
|
|
1055
|
+
...opts,
|
|
1056
|
+
body: getValidRequestBody(opts)
|
|
1057
|
+
};
|
|
1058
|
+
request2 = new Request(url, requestInit);
|
|
1059
|
+
for (const fn of interceptors.request.fns) {
|
|
1060
|
+
if (fn) {
|
|
1061
|
+
request2 = await fn(request2, opts);
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
const _fetch = opts.fetch;
|
|
1065
|
+
response = await _fetch(request2);
|
|
1066
|
+
for (const fn of interceptors.response.fns) {
|
|
1067
|
+
if (fn) {
|
|
1068
|
+
response = await fn(response, request2, opts);
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
const result = {
|
|
1072
|
+
request: request2,
|
|
1073
|
+
response
|
|
1074
|
+
};
|
|
1075
|
+
if (response.ok) {
|
|
1076
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
1077
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
1078
|
+
let emptyData;
|
|
1079
|
+
switch (parseAs) {
|
|
1080
|
+
case "arrayBuffer":
|
|
1081
|
+
case "blob":
|
|
1082
|
+
case "text":
|
|
1083
|
+
emptyData = await response[parseAs]();
|
|
1084
|
+
break;
|
|
1085
|
+
case "formData":
|
|
1086
|
+
emptyData = new FormData();
|
|
1087
|
+
break;
|
|
1088
|
+
case "stream":
|
|
1089
|
+
emptyData = response.body;
|
|
1090
|
+
break;
|
|
1091
|
+
case "json":
|
|
1092
|
+
default:
|
|
1093
|
+
emptyData = {};
|
|
1094
|
+
break;
|
|
1095
|
+
}
|
|
1096
|
+
return opts.responseStyle === "data" ? emptyData : {
|
|
1097
|
+
data: emptyData,
|
|
1098
|
+
...result
|
|
1099
|
+
};
|
|
1100
|
+
}
|
|
1101
|
+
let data;
|
|
1102
|
+
switch (parseAs) {
|
|
1103
|
+
case "arrayBuffer":
|
|
1104
|
+
case "blob":
|
|
1105
|
+
case "formData":
|
|
1106
|
+
case "text":
|
|
1107
|
+
data = await response[parseAs]();
|
|
1108
|
+
break;
|
|
1109
|
+
case "json": {
|
|
1110
|
+
const text = await response.text();
|
|
1111
|
+
data = text ? JSON.parse(text) : {};
|
|
1112
|
+
break;
|
|
1113
|
+
}
|
|
1114
|
+
case "stream":
|
|
1115
|
+
return opts.responseStyle === "data" ? response.body : {
|
|
1116
|
+
data: response.body,
|
|
1117
|
+
...result
|
|
1118
|
+
};
|
|
1119
|
+
}
|
|
1120
|
+
if (parseAs === "json") {
|
|
1121
|
+
if (opts.responseValidator) {
|
|
1122
|
+
await opts.responseValidator(data);
|
|
1123
|
+
}
|
|
1124
|
+
if (opts.responseTransformer) {
|
|
1125
|
+
data = await opts.responseTransformer(data);
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
return opts.responseStyle === "data" ? data : {
|
|
1129
|
+
data,
|
|
1130
|
+
...result
|
|
1131
|
+
};
|
|
1132
|
+
}
|
|
1133
|
+
const textError = await response.text();
|
|
1134
|
+
let jsonError;
|
|
1135
|
+
try {
|
|
1136
|
+
jsonError = JSON.parse(textError);
|
|
1137
|
+
} catch {
|
|
1138
|
+
}
|
|
1139
|
+
throw jsonError ?? textError;
|
|
1140
|
+
} catch (error) {
|
|
1141
|
+
let finalError = error;
|
|
1142
|
+
for (const fn of interceptors.error.fns) {
|
|
1143
|
+
if (fn) {
|
|
1144
|
+
finalError = await fn(finalError, response, request2, options);
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
finalError = finalError || {};
|
|
1148
|
+
if (throwOnError) {
|
|
1149
|
+
throw finalError;
|
|
1150
|
+
}
|
|
1151
|
+
return responseStyle === "data" ? void 0 : {
|
|
1152
|
+
error: finalError,
|
|
1153
|
+
request: request2,
|
|
1154
|
+
response
|
|
1155
|
+
};
|
|
1156
|
+
}
|
|
1157
|
+
}, "request");
|
|
1158
|
+
const makeMethodFn = /* @__PURE__ */ __name((method) => (options) => request({ ...options, method }), "makeMethodFn");
|
|
1159
|
+
const makeSseFn = /* @__PURE__ */ __name((method) => async (options) => {
|
|
1160
|
+
const { opts, url } = await beforeRequest(options);
|
|
1161
|
+
return createSseClient({
|
|
1162
|
+
...opts,
|
|
1163
|
+
body: opts.body,
|
|
1164
|
+
method,
|
|
1165
|
+
onRequest: /* @__PURE__ */ __name(async (url2, init) => {
|
|
1166
|
+
let request2 = new Request(url2, init);
|
|
1167
|
+
for (const fn of interceptors.request.fns) {
|
|
1168
|
+
if (fn) {
|
|
1169
|
+
request2 = await fn(request2, opts);
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
return request2;
|
|
1173
|
+
}, "onRequest"),
|
|
1174
|
+
serializedBody: getValidRequestBody(opts),
|
|
1175
|
+
url
|
|
1176
|
+
});
|
|
1177
|
+
}, "makeSseFn");
|
|
1178
|
+
const _buildUrl = /* @__PURE__ */ __name((options) => buildUrl({ ..._config, ...options }), "_buildUrl");
|
|
1179
|
+
return {
|
|
1180
|
+
buildUrl: _buildUrl,
|
|
1181
|
+
connect: makeMethodFn("CONNECT"),
|
|
1182
|
+
delete: makeMethodFn("DELETE"),
|
|
1183
|
+
get: makeMethodFn("GET"),
|
|
1184
|
+
getConfig,
|
|
1185
|
+
head: makeMethodFn("HEAD"),
|
|
1186
|
+
interceptors,
|
|
1187
|
+
options: makeMethodFn("OPTIONS"),
|
|
1188
|
+
patch: makeMethodFn("PATCH"),
|
|
1189
|
+
post: makeMethodFn("POST"),
|
|
1190
|
+
put: makeMethodFn("PUT"),
|
|
1191
|
+
request,
|
|
1192
|
+
setConfig,
|
|
1193
|
+
sse: {
|
|
1194
|
+
connect: makeSseFn("CONNECT"),
|
|
1195
|
+
delete: makeSseFn("DELETE"),
|
|
1196
|
+
get: makeSseFn("GET"),
|
|
1197
|
+
head: makeSseFn("HEAD"),
|
|
1198
|
+
options: makeSseFn("OPTIONS"),
|
|
1199
|
+
patch: makeSseFn("PATCH"),
|
|
1200
|
+
post: makeSseFn("POST"),
|
|
1201
|
+
put: makeSseFn("PUT"),
|
|
1202
|
+
trace: makeSseFn("TRACE")
|
|
1203
|
+
},
|
|
1204
|
+
trace: makeMethodFn("TRACE")
|
|
1205
|
+
};
|
|
1206
|
+
}, "createClient");
|
|
1207
|
+
|
|
1208
|
+
// src/_api/generated/client.gen.ts
|
|
1209
|
+
var client = createClient(createConfig({ baseUrl: "http://localhost:8000" }));
|
|
1210
|
+
installAuthOnClient(client);
|
|
1211
|
+
|
|
1212
|
+
// src/_api/generated/sdk.gen.ts
|
|
1213
|
+
var CfgAccountsApiKey = class {
|
|
1214
|
+
static {
|
|
1215
|
+
__name(this, "CfgAccountsApiKey");
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Get API key details
|
|
1219
|
+
*
|
|
1220
|
+
* Retrieve the current user's API key (masked) and metadata.
|
|
1221
|
+
*/
|
|
1222
|
+
static cfgAccountsApiKeyRetrieve(options) {
|
|
1223
|
+
return (options?.client ?? client).get({
|
|
1224
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1225
|
+
in: "cookie",
|
|
1226
|
+
name: "sessionid",
|
|
1227
|
+
type: "apiKey"
|
|
1228
|
+
}],
|
|
1229
|
+
url: "/cfg/accounts/api-key/",
|
|
1230
|
+
...options
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
1233
|
+
/**
|
|
1234
|
+
* Regenerate API key
|
|
1235
|
+
*
|
|
1236
|
+
* Generate a new API key. The full key is returned only once.
|
|
1237
|
+
*/
|
|
1238
|
+
static cfgAccountsApiKeyRegenerateCreate(options) {
|
|
1239
|
+
return (options.client ?? client).post({
|
|
1240
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1241
|
+
in: "cookie",
|
|
1242
|
+
name: "sessionid",
|
|
1243
|
+
type: "apiKey"
|
|
1244
|
+
}],
|
|
1245
|
+
url: "/cfg/accounts/api-key/regenerate/",
|
|
1246
|
+
...options,
|
|
1247
|
+
headers: {
|
|
1248
|
+
"Content-Type": "application/json",
|
|
1249
|
+
...options.headers
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
/**
|
|
1254
|
+
* Test API key
|
|
1255
|
+
*
|
|
1256
|
+
* Test whether an API key is valid without consuming it.
|
|
1257
|
+
*/
|
|
1258
|
+
static cfgAccountsApiKeyTestCreate(options) {
|
|
1259
|
+
return (options.client ?? client).post({
|
|
1260
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1261
|
+
in: "cookie",
|
|
1262
|
+
name: "sessionid",
|
|
1263
|
+
type: "apiKey"
|
|
1264
|
+
}],
|
|
1265
|
+
url: "/cfg/accounts/api-key/test/",
|
|
1266
|
+
...options,
|
|
1267
|
+
headers: {
|
|
1268
|
+
"Content-Type": "application/json",
|
|
1269
|
+
...options.headers
|
|
1270
|
+
}
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1273
|
+
};
|
|
1274
|
+
var CfgAccountsOauth = class {
|
|
1275
|
+
static {
|
|
1276
|
+
__name(this, "CfgAccountsOauth");
|
|
1277
|
+
}
|
|
1278
|
+
/**
|
|
1279
|
+
* List OAuth connections
|
|
1280
|
+
*
|
|
1281
|
+
* Get all OAuth connections for the current user.
|
|
1282
|
+
*/
|
|
1283
|
+
static cfgAccountsOauthConnectionsList(options) {
|
|
1284
|
+
return (options?.client ?? client).get({
|
|
1285
|
+
security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
|
|
1286
|
+
url: "/cfg/accounts/oauth/connections/",
|
|
1287
|
+
...options
|
|
1288
|
+
});
|
|
1289
|
+
}
|
|
1290
|
+
/**
|
|
1291
|
+
* Disconnect OAuth provider
|
|
1292
|
+
*
|
|
1293
|
+
* Remove OAuth connection for the specified provider.
|
|
1294
|
+
*/
|
|
1295
|
+
static cfgAccountsOauthDisconnectCreate(options) {
|
|
1296
|
+
return (options.client ?? client).post({
|
|
1297
|
+
security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
|
|
1298
|
+
url: "/cfg/accounts/oauth/disconnect/",
|
|
1299
|
+
...options,
|
|
1300
|
+
headers: {
|
|
1301
|
+
"Content-Type": "application/json",
|
|
1302
|
+
...options.headers
|
|
1303
|
+
}
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
/**
|
|
1307
|
+
* Start GitHub OAuth
|
|
1308
|
+
*
|
|
1309
|
+
* Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
|
|
1310
|
+
*/
|
|
1311
|
+
static cfgAccountsOauthGithubAuthorizeCreate(options) {
|
|
1312
|
+
return (options?.client ?? client).post({
|
|
1313
|
+
url: "/cfg/accounts/oauth/github/authorize/",
|
|
1314
|
+
...options,
|
|
1315
|
+
headers: {
|
|
1316
|
+
"Content-Type": "application/json",
|
|
1317
|
+
...options?.headers
|
|
1318
|
+
}
|
|
1319
|
+
});
|
|
1320
|
+
}
|
|
1321
|
+
/**
|
|
1322
|
+
* Complete GitHub OAuth
|
|
1323
|
+
*
|
|
1324
|
+
* Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
|
|
1325
|
+
*/
|
|
1326
|
+
static cfgAccountsOauthGithubCallbackCreate(options) {
|
|
1327
|
+
return (options.client ?? client).post({
|
|
1328
|
+
url: "/cfg/accounts/oauth/github/callback/",
|
|
1329
|
+
...options,
|
|
1330
|
+
headers: {
|
|
1331
|
+
"Content-Type": "application/json",
|
|
1332
|
+
...options.headers
|
|
1333
|
+
}
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* List OAuth providers
|
|
1338
|
+
*
|
|
1339
|
+
* Get list of available OAuth providers for authentication.
|
|
1340
|
+
*/
|
|
1341
|
+
static cfgAccountsOauthProvidersRetrieve(options) {
|
|
1342
|
+
return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
|
|
1343
|
+
}
|
|
1344
|
+
};
|
|
1345
|
+
var CfgAccounts = class {
|
|
1346
|
+
static {
|
|
1347
|
+
__name(this, "CfgAccounts");
|
|
1348
|
+
}
|
|
1349
|
+
/**
|
|
1350
|
+
* Request OTP code to email.
|
|
1351
|
+
*/
|
|
1352
|
+
static cfgAccountsOtpRequestCreate(options) {
|
|
1353
|
+
return (options.client ?? client).post({
|
|
1354
|
+
security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
|
|
1355
|
+
url: "/cfg/accounts/otp/request/",
|
|
1356
|
+
...options,
|
|
1357
|
+
headers: {
|
|
1358
|
+
"Content-Type": "application/json",
|
|
1359
|
+
...options.headers
|
|
1360
|
+
}
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
/**
|
|
1364
|
+
* Verify OTP code and return JWT tokens or 2FA session.
|
|
1365
|
+
*
|
|
1366
|
+
* If user has 2FA enabled:
|
|
1367
|
+
* - Returns requires_2fa=True with session_id
|
|
1368
|
+
* - Client must complete 2FA verification at /cfg/totp/verify/
|
|
1369
|
+
*
|
|
1370
|
+
* If user has no 2FA:
|
|
1371
|
+
* - Returns JWT tokens and user data directly
|
|
1372
|
+
*/
|
|
1373
|
+
static cfgAccountsOtpVerifyCreate(options) {
|
|
1374
|
+
return (options.client ?? client).post({
|
|
1375
|
+
security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
|
|
1376
|
+
url: "/cfg/accounts/otp/verify/",
|
|
1377
|
+
...options,
|
|
1378
|
+
headers: {
|
|
1379
|
+
"Content-Type": "application/json",
|
|
1380
|
+
...options.headers
|
|
1381
|
+
}
|
|
1382
|
+
});
|
|
1383
|
+
}
|
|
1384
|
+
};
|
|
1385
|
+
var CfgAccountsProfile = class {
|
|
1386
|
+
static {
|
|
1387
|
+
__name(this, "CfgAccountsProfile");
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* Get current user profile
|
|
1391
|
+
*
|
|
1392
|
+
* Retrieve the current authenticated user's profile information.
|
|
1393
|
+
*/
|
|
1394
|
+
static cfgAccountsProfileRetrieve(options) {
|
|
1395
|
+
return (options?.client ?? client).get({
|
|
1396
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1397
|
+
in: "cookie",
|
|
1398
|
+
name: "sessionid",
|
|
1399
|
+
type: "apiKey"
|
|
1400
|
+
}],
|
|
1401
|
+
url: "/cfg/accounts/profile/",
|
|
1402
|
+
...options
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
/**
|
|
1406
|
+
* Upload user avatar
|
|
1407
|
+
*
|
|
1408
|
+
* Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
|
|
1409
|
+
*/
|
|
1410
|
+
static cfgAccountsProfileAvatarCreate(options) {
|
|
1411
|
+
return (options?.client ?? client).post({
|
|
1412
|
+
...formDataBodySerializer,
|
|
1413
|
+
security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
|
|
1414
|
+
url: "/cfg/accounts/profile/avatar/",
|
|
1415
|
+
...options,
|
|
1416
|
+
headers: {
|
|
1417
|
+
"Content-Type": null,
|
|
1418
|
+
...options?.headers
|
|
1419
|
+
}
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
/**
|
|
1423
|
+
* Delete user account
|
|
1424
|
+
*
|
|
1425
|
+
*
|
|
1426
|
+
* Permanently delete the current user's account.
|
|
1427
|
+
*
|
|
1428
|
+
* This operation:
|
|
1429
|
+
* - Deactivates the account (user cannot log in)
|
|
1430
|
+
* - Anonymizes personal data (GDPR compliance)
|
|
1431
|
+
* - Frees up the email address for re-registration
|
|
1432
|
+
* - Preserves audit trail
|
|
1433
|
+
*
|
|
1434
|
+
* The account can be restored by an administrator if needed.
|
|
1435
|
+
*
|
|
1436
|
+
*/
|
|
1437
|
+
static cfgAccountsProfileDeleteCreate(options) {
|
|
1438
|
+
return (options?.client ?? client).post({
|
|
1439
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1440
|
+
in: "cookie",
|
|
1441
|
+
name: "sessionid",
|
|
1442
|
+
type: "apiKey"
|
|
1443
|
+
}],
|
|
1444
|
+
url: "/cfg/accounts/profile/delete/",
|
|
1445
|
+
...options
|
|
1446
|
+
});
|
|
1447
|
+
}
|
|
1448
|
+
/**
|
|
1449
|
+
* Partial update user profile
|
|
1450
|
+
*
|
|
1451
|
+
* Partially update the current authenticated user's profile information. Supports avatar upload.
|
|
1452
|
+
*/
|
|
1453
|
+
static cfgAccountsProfilePartialPartialUpdate(options) {
|
|
1454
|
+
return (options?.client ?? client).patch({
|
|
1455
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1456
|
+
in: "cookie",
|
|
1457
|
+
name: "sessionid",
|
|
1458
|
+
type: "apiKey"
|
|
1459
|
+
}],
|
|
1460
|
+
url: "/cfg/accounts/profile/partial/",
|
|
1461
|
+
...options,
|
|
1462
|
+
headers: {
|
|
1463
|
+
"Content-Type": "application/json",
|
|
1464
|
+
...options?.headers
|
|
1465
|
+
}
|
|
1466
|
+
});
|
|
1467
|
+
}
|
|
1468
|
+
/**
|
|
1469
|
+
* Partial update user profile
|
|
1470
|
+
*
|
|
1471
|
+
* Partially update the current authenticated user's profile information. Supports avatar upload.
|
|
1472
|
+
*/
|
|
1473
|
+
static cfgAccountsProfilePartialUpdate(options) {
|
|
1474
|
+
return (options?.client ?? client).put({
|
|
1475
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1476
|
+
in: "cookie",
|
|
1477
|
+
name: "sessionid",
|
|
1478
|
+
type: "apiKey"
|
|
1479
|
+
}],
|
|
1480
|
+
url: "/cfg/accounts/profile/partial/",
|
|
1481
|
+
...options,
|
|
1482
|
+
headers: {
|
|
1483
|
+
"Content-Type": "application/json",
|
|
1484
|
+
...options?.headers
|
|
1485
|
+
}
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
/**
|
|
1489
|
+
* Update user profile
|
|
1490
|
+
*
|
|
1491
|
+
* Update the current authenticated user's profile information.
|
|
1492
|
+
*/
|
|
1493
|
+
static cfgAccountsProfileUpdatePartialUpdate(options) {
|
|
1494
|
+
return (options?.client ?? client).patch({
|
|
1495
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1496
|
+
in: "cookie",
|
|
1497
|
+
name: "sessionid",
|
|
1498
|
+
type: "apiKey"
|
|
1499
|
+
}],
|
|
1500
|
+
url: "/cfg/accounts/profile/update/",
|
|
1501
|
+
...options,
|
|
1502
|
+
headers: {
|
|
1503
|
+
"Content-Type": "application/json",
|
|
1504
|
+
...options?.headers
|
|
1505
|
+
}
|
|
1506
|
+
});
|
|
1507
|
+
}
|
|
1508
|
+
/**
|
|
1509
|
+
* Update user profile
|
|
1510
|
+
*
|
|
1511
|
+
* Update the current authenticated user's profile information.
|
|
1512
|
+
*/
|
|
1513
|
+
static cfgAccountsProfileUpdateUpdate(options) {
|
|
1514
|
+
return (options?.client ?? client).put({
|
|
1515
|
+
security: [{ scheme: "bearer", type: "http" }, {
|
|
1516
|
+
in: "cookie",
|
|
1517
|
+
name: "sessionid",
|
|
1518
|
+
type: "apiKey"
|
|
1519
|
+
}],
|
|
1520
|
+
url: "/cfg/accounts/profile/update/",
|
|
1521
|
+
...options,
|
|
1522
|
+
headers: {
|
|
1523
|
+
"Content-Type": "application/json",
|
|
1524
|
+
...options?.headers
|
|
1525
|
+
}
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
};
|
|
1529
|
+
var CfgAccountsAuth = class {
|
|
1530
|
+
static {
|
|
1531
|
+
__name(this, "CfgAccountsAuth");
|
|
1532
|
+
}
|
|
1533
|
+
/**
|
|
1534
|
+
* Refresh JWT token.
|
|
1535
|
+
*/
|
|
1536
|
+
static cfgAccountsTokenRefreshCreate(options) {
|
|
1537
|
+
return (options.client ?? client).post({
|
|
1538
|
+
url: "/cfg/accounts/token/refresh/",
|
|
1539
|
+
...options,
|
|
1540
|
+
headers: {
|
|
1541
|
+
"Content-Type": "application/json",
|
|
1542
|
+
...options.headers
|
|
1543
|
+
}
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1546
|
+
};
|
|
1547
|
+
var CfgCentrifugo = class {
|
|
1548
|
+
static {
|
|
1549
|
+
__name(this, "CfgCentrifugo");
|
|
1550
|
+
}
|
|
1551
|
+
/**
|
|
1552
|
+
* Get Centrifugo connection token
|
|
1553
|
+
*
|
|
1554
|
+
* Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
|
|
1555
|
+
*/
|
|
1556
|
+
static cfgCentrifugoAuthTokenRetrieve(options) {
|
|
1557
|
+
return (options?.client ?? client).get({
|
|
1558
|
+
security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
|
|
1559
|
+
url: "/cfg/centrifugo/auth/token/",
|
|
1560
|
+
...options
|
|
1561
|
+
});
|
|
1562
|
+
}
|
|
1563
|
+
};
|
|
1564
|
+
var CfgTotpBackupCodes = class {
|
|
1565
|
+
static {
|
|
1566
|
+
__name(this, "CfgTotpBackupCodes");
|
|
1567
|
+
}
|
|
1568
|
+
/**
|
|
1569
|
+
* Get backup codes status for user.
|
|
1570
|
+
*/
|
|
1571
|
+
static cfgTotpBackupCodesRetrieve(options) {
|
|
1572
|
+
return (options?.client ?? client).get({
|
|
1573
|
+
security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
|
|
1574
|
+
url: "/cfg/totp/backup-codes/",
|
|
1575
|
+
...options
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1578
|
+
/**
|
|
1579
|
+
* Regenerate backup codes.
|
|
1580
|
+
*
|
|
1581
|
+
* Requires TOTP code for verification.
|
|
1582
|
+
* Invalidates all existing codes.
|
|
1583
|
+
*/
|
|
1584
|
+
static cfgTotpBackupCodesRegenerateCreate(options) {
|
|
1585
|
+
return (options.client ?? client).post({
|
|
1586
|
+
security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
|
|
1587
|
+
url: "/cfg/totp/backup-codes/regenerate/",
|
|
1588
|
+
...options,
|
|
1589
|
+
headers: {
|
|
1590
|
+
"Content-Type": "application/json",
|
|
1591
|
+
...options.headers
|
|
1592
|
+
}
|
|
1593
|
+
});
|
|
1594
|
+
}
|
|
1595
|
+
};
|
|
1596
|
+
var CfgTotp = class {
|
|
1597
|
+
static {
|
|
1598
|
+
__name(this, "CfgTotp");
|
|
1599
|
+
}
|
|
1600
|
+
/**
|
|
1601
|
+
* List all TOTP devices for user.
|
|
1602
|
+
*/
|
|
1603
|
+
static cfgTotpDevicesRetrieve(options) {
|
|
1604
|
+
return (options?.client ?? client).get({
|
|
1605
|
+
security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
|
|
1606
|
+
url: "/cfg/totp/devices/",
|
|
1607
|
+
...options
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
/**
|
|
1611
|
+
* Delete a TOTP device.
|
|
1612
|
+
*
|
|
1613
|
+
* Requires verification code if removing the last/primary device.
|
|
1614
|
+
*/
|
|
1615
|
+
static cfgTotpDevicesDestroy(options) {
|
|
1616
|
+
return (options.client ?? client).delete({
|
|
1617
|
+
security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
|
|
1618
|
+
url: "/cfg/totp/devices/{id}/",
|
|
1619
|
+
...options
|
|
1620
|
+
});
|
|
1621
|
+
}
|
|
1622
|
+
/**
|
|
1623
|
+
* Completely disable 2FA for account.
|
|
1624
|
+
*
|
|
1625
|
+
* Requires verification code.
|
|
1626
|
+
*/
|
|
1627
|
+
static cfgTotpDisableCreate(options) {
|
|
1628
|
+
return (options.client ?? client).post({
|
|
1629
|
+
security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
|
|
1630
|
+
url: "/cfg/totp/disable/",
|
|
1631
|
+
...options,
|
|
1632
|
+
headers: {
|
|
1633
|
+
"Content-Type": "application/json",
|
|
1634
|
+
...options.headers
|
|
1635
|
+
}
|
|
1636
|
+
});
|
|
1637
|
+
}
|
|
1638
|
+
};
|
|
1639
|
+
var CfgTotpSetup = class {
|
|
1640
|
+
static {
|
|
1641
|
+
__name(this, "CfgTotpSetup");
|
|
1642
|
+
}
|
|
1643
|
+
/**
|
|
1644
|
+
* Start 2FA setup process.
|
|
1645
|
+
*
|
|
1646
|
+
* Creates a new TOTP device and returns QR code for scanning.
|
|
1647
|
+
*/
|
|
1648
|
+
static cfgTotpSetupCreate(options) {
|
|
1649
|
+
return (options?.client ?? client).post({
|
|
1650
|
+
security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
|
|
1651
|
+
url: "/cfg/totp/setup/",
|
|
1652
|
+
...options,
|
|
1653
|
+
headers: {
|
|
1654
|
+
"Content-Type": "application/json",
|
|
1655
|
+
...options?.headers
|
|
1656
|
+
}
|
|
1657
|
+
});
|
|
1658
|
+
}
|
|
1659
|
+
/**
|
|
1660
|
+
* Confirm 2FA setup with first valid code.
|
|
1661
|
+
*
|
|
1662
|
+
* Activates the device and generates backup codes.
|
|
1663
|
+
*/
|
|
1664
|
+
static cfgTotpSetupConfirmCreate(options) {
|
|
1665
|
+
return (options.client ?? client).post({
|
|
1666
|
+
security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
|
|
1667
|
+
url: "/cfg/totp/setup/confirm/",
|
|
1668
|
+
...options,
|
|
1669
|
+
headers: {
|
|
1670
|
+
"Content-Type": "application/json",
|
|
1671
|
+
...options.headers
|
|
1672
|
+
}
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1675
|
+
};
|
|
1676
|
+
var CfgTotpVerify = class {
|
|
1677
|
+
static {
|
|
1678
|
+
__name(this, "CfgTotpVerify");
|
|
1679
|
+
}
|
|
1680
|
+
/**
|
|
1681
|
+
* Verify TOTP code for 2FA session.
|
|
1682
|
+
*
|
|
1683
|
+
* Completes authentication and returns JWT tokens on success.
|
|
1684
|
+
*/
|
|
1685
|
+
static cfgTotpVerifyCreate(options) {
|
|
1686
|
+
return (options.client ?? client).post({
|
|
1687
|
+
security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
|
|
1688
|
+
url: "/cfg/totp/verify/",
|
|
1689
|
+
...options,
|
|
1690
|
+
headers: {
|
|
1691
|
+
"Content-Type": "application/json",
|
|
1692
|
+
...options.headers
|
|
1693
|
+
}
|
|
1694
|
+
});
|
|
1695
|
+
}
|
|
1696
|
+
/**
|
|
1697
|
+
* Verify backup recovery code for 2FA session.
|
|
1698
|
+
*
|
|
1699
|
+
* Alternative verification method when TOTP device unavailable.
|
|
1700
|
+
*/
|
|
1701
|
+
static cfgTotpVerifyBackupCreate(options) {
|
|
1702
|
+
return (options.client ?? client).post({
|
|
1703
|
+
security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
|
|
1704
|
+
url: "/cfg/totp/verify/backup/",
|
|
1705
|
+
...options,
|
|
1706
|
+
headers: {
|
|
1707
|
+
"Content-Type": "application/json",
|
|
1708
|
+
...options.headers
|
|
1709
|
+
}
|
|
1710
|
+
});
|
|
1711
|
+
}
|
|
1712
|
+
};
|
|
1713
|
+
|
|
297
1714
|
// src/_api/generated/_cfg_accounts/api.ts
|
|
298
1715
|
var API = class {
|
|
299
1716
|
static {
|
|
300
1717
|
__name(this, "API");
|
|
301
1718
|
}
|
|
302
1719
|
logger;
|
|
1720
|
+
cfgAccountsApiKey = CfgAccountsApiKey;
|
|
1721
|
+
cfgAccountsOauth = CfgAccountsOauth;
|
|
1722
|
+
cfgAccounts = CfgAccounts;
|
|
1723
|
+
cfgAccountsProfile = CfgAccountsProfile;
|
|
1724
|
+
cfgAccountsAuth = CfgAccountsAuth;
|
|
303
1725
|
constructor(_baseUrl, opts = {}) {
|
|
304
1726
|
this.logger = new APILogger(opts.logger);
|
|
305
1727
|
if (_baseUrl) auth.setBaseUrl(_baseUrl);
|
|
@@ -363,6 +1785,7 @@ var API2 = class {
|
|
|
363
1785
|
__name(this, "API");
|
|
364
1786
|
}
|
|
365
1787
|
logger;
|
|
1788
|
+
cfgCentrifugo = CfgCentrifugo;
|
|
366
1789
|
constructor(_baseUrl, opts = {}) {
|
|
367
1790
|
this.logger = new APILogger(opts.logger);
|
|
368
1791
|
if (_baseUrl) auth.setBaseUrl(_baseUrl);
|
|
@@ -426,6 +1849,10 @@ var API3 = class {
|
|
|
426
1849
|
__name(this, "API");
|
|
427
1850
|
}
|
|
428
1851
|
logger;
|
|
1852
|
+
cfgTotpBackupCodes = CfgTotpBackupCodes;
|
|
1853
|
+
cfgTotp = CfgTotp;
|
|
1854
|
+
cfgTotpSetup = CfgTotpSetup;
|
|
1855
|
+
cfgTotpVerify = CfgTotpVerify;
|
|
429
1856
|
constructor(_baseUrl, opts = {}) {
|
|
430
1857
|
this.logger = new APILogger(opts.logger);
|
|
431
1858
|
if (_baseUrl) auth.setBaseUrl(_baseUrl);
|