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