@djangocfg/api 2.1.331 → 2.1.333
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth-server.cjs +1130 -1067
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +1130 -1067
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +1229 -1166
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.mjs +1229 -1166
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +210 -974
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +24 -49
- package/dist/clients.d.ts +24 -49
- package/dist/clients.mjs +210 -974
- package/dist/clients.mjs.map +1 -1
- package/dist/index.cjs +1199 -1099
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +673 -657
- package/dist/index.d.ts +673 -657
- package/dist/index.mjs +1199 -1099
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_api/generated/_cfg_accounts/api.ts +29 -82
- package/src/_api/generated/_cfg_accounts/index.ts +4 -4
- package/src/_api/generated/_cfg_centrifugo/api.ts +29 -82
- package/src/_api/generated/_cfg_centrifugo/index.ts +4 -4
- package/src/_api/generated/_cfg_totp/api.ts +29 -82
- package/src/_api/generated/_cfg_totp/index.ts +4 -4
- package/src/_api/generated/client.gen.ts +4 -0
- package/src/_api/generated/helpers/auth.ts +240 -0
- package/src/_api/generated/helpers/index.ts +1 -0
- package/src/_api/generated/index.ts +17 -13
package/dist/auth.cjs
CHANGED
|
@@ -102,7 +102,7 @@ __name(withBasePath, "withBasePath");
|
|
|
102
102
|
function useCfgRouter() {
|
|
103
103
|
const router = (0, import_navigation.useRouter)();
|
|
104
104
|
const basePath = (0, import_react.useMemo)(() => getBasePath(), []);
|
|
105
|
-
const
|
|
105
|
+
const isStaticBuild2 = (0, import_react.useMemo)(() => {
|
|
106
106
|
return typeof process !== "undefined" && process.env.NEXT_PUBLIC_STATIC_BUILD === "true";
|
|
107
107
|
}, []);
|
|
108
108
|
const push = (0, import_react.useCallback)((href, options) => {
|
|
@@ -312,1290 +312,1353 @@ var useAutoAuth = /* @__PURE__ */ __name((options = {}) => {
|
|
|
312
312
|
// src/auth/hooks/useTwoFactor.ts
|
|
313
313
|
var import_react6 = require("react");
|
|
314
314
|
|
|
315
|
-
// src/_api/generated/
|
|
316
|
-
var
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
315
|
+
// src/_api/generated/helpers/auth.ts
|
|
316
|
+
var ACCESS_KEY = "cfg.access_token";
|
|
317
|
+
var REFRESH_KEY = "cfg.refresh_token";
|
|
318
|
+
var API_KEY_KEY = "cfg.api_key";
|
|
319
|
+
var isBrowser2 = typeof window !== "undefined";
|
|
320
|
+
var localStorageBackend = {
|
|
321
|
+
get(key) {
|
|
322
|
+
if (!isBrowser2) return null;
|
|
323
|
+
try {
|
|
324
|
+
return window.localStorage.getItem(key);
|
|
325
|
+
} catch {
|
|
326
|
+
return null;
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
set(key, value) {
|
|
330
|
+
if (!isBrowser2) return;
|
|
331
|
+
try {
|
|
332
|
+
if (value === null) window.localStorage.removeItem(key);
|
|
333
|
+
else window.localStorage.setItem(key, value);
|
|
334
|
+
} catch {
|
|
335
|
+
}
|
|
323
336
|
}
|
|
324
|
-
}
|
|
325
|
-
var
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
337
|
+
};
|
|
338
|
+
var COOKIE_MAX_AGE = 60 * 60 * 24 * 30;
|
|
339
|
+
var cookieBackend = {
|
|
340
|
+
get(key) {
|
|
341
|
+
if (!isBrowser2) return null;
|
|
342
|
+
try {
|
|
343
|
+
const re = new RegExp(`(?:^|;\\s*)${encodeURIComponent(key)}=([^;]*)`);
|
|
344
|
+
const m = document.cookie.match(re);
|
|
345
|
+
return m ? decodeURIComponent(m[1]) : null;
|
|
346
|
+
} catch {
|
|
347
|
+
return null;
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
set(key, value) {
|
|
351
|
+
if (!isBrowser2) return;
|
|
352
|
+
try {
|
|
353
|
+
const k = encodeURIComponent(key);
|
|
354
|
+
const secure = window.location.protocol === "https:" ? "; Secure" : "";
|
|
355
|
+
if (value === null) {
|
|
356
|
+
document.cookie = `${k}=; Path=/; Max-Age=0; SameSite=Lax${secure}`;
|
|
334
357
|
} else {
|
|
335
|
-
|
|
358
|
+
const v = encodeURIComponent(value);
|
|
359
|
+
document.cookie = `${k}=${v}; Path=/; Max-Age=${COOKIE_MAX_AGE}; SameSite=Lax${secure}`;
|
|
336
360
|
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
var jsonBodySerializer = {
|
|
342
|
-
bodySerializer: /* @__PURE__ */ __name((body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value), "bodySerializer")
|
|
361
|
+
} catch {
|
|
362
|
+
}
|
|
363
|
+
}
|
|
343
364
|
};
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
365
|
+
var _storage = localStorageBackend;
|
|
366
|
+
var _storageMode = "localStorage";
|
|
367
|
+
function detectLocale() {
|
|
368
|
+
try {
|
|
369
|
+
if (typeof document !== "undefined") {
|
|
370
|
+
const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
371
|
+
if (m) return decodeURIComponent(m[1]);
|
|
372
|
+
}
|
|
373
|
+
if (typeof navigator !== "undefined" && navigator.language) {
|
|
374
|
+
return navigator.language;
|
|
375
|
+
}
|
|
376
|
+
} catch {
|
|
377
|
+
}
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
__name(detectLocale, "detectLocale");
|
|
381
|
+
function defaultBaseUrl() {
|
|
382
|
+
try {
|
|
383
|
+
if (typeof process !== "undefined" && process.env) {
|
|
384
|
+
if (process.env.NEXT_PUBLIC_STATIC_BUILD === "true") return "";
|
|
385
|
+
return process.env.NEXT_PUBLIC_API_URL || "";
|
|
386
|
+
}
|
|
387
|
+
} catch {
|
|
388
|
+
}
|
|
389
|
+
return "";
|
|
390
|
+
}
|
|
391
|
+
__name(defaultBaseUrl, "defaultBaseUrl");
|
|
392
|
+
function defaultApiKey() {
|
|
393
|
+
try {
|
|
394
|
+
if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_API_KEY) {
|
|
395
|
+
return process.env.NEXT_PUBLIC_API_KEY;
|
|
396
|
+
}
|
|
397
|
+
} catch {
|
|
398
|
+
}
|
|
399
|
+
return null;
|
|
400
|
+
}
|
|
401
|
+
__name(defaultApiKey, "defaultApiKey");
|
|
402
|
+
var _localeOverride = null;
|
|
403
|
+
var _apiKeyOverride = null;
|
|
404
|
+
var _baseUrlOverride = null;
|
|
405
|
+
var _withCredentials = true;
|
|
406
|
+
var _onUnauthorized = null;
|
|
407
|
+
var _client = null;
|
|
408
|
+
function pushClientConfig() {
|
|
409
|
+
if (!_client) return;
|
|
410
|
+
_client.setConfig({
|
|
411
|
+
baseUrl: auth.getBaseUrl(),
|
|
412
|
+
credentials: _withCredentials ? "include" : "same-origin"
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
__name(pushClientConfig, "pushClientConfig");
|
|
416
|
+
var auth = {
|
|
417
|
+
// ── Storage mode ──────────────────────────────────────────────────
|
|
418
|
+
getStorageMode() {
|
|
419
|
+
return _storageMode;
|
|
420
|
+
},
|
|
421
|
+
setStorageMode(mode) {
|
|
422
|
+
_storageMode = mode;
|
|
423
|
+
_storage = mode === "cookie" ? cookieBackend : localStorageBackend;
|
|
424
|
+
},
|
|
425
|
+
// ── Bearer token ──────────────────────────────────────────────────
|
|
426
|
+
getToken() {
|
|
427
|
+
return _storage.get(ACCESS_KEY);
|
|
428
|
+
},
|
|
429
|
+
setToken(token) {
|
|
430
|
+
_storage.set(ACCESS_KEY, token);
|
|
431
|
+
},
|
|
432
|
+
getRefreshToken() {
|
|
433
|
+
return _storage.get(REFRESH_KEY);
|
|
434
|
+
},
|
|
435
|
+
setRefreshToken(token) {
|
|
436
|
+
_storage.set(REFRESH_KEY, token);
|
|
437
|
+
},
|
|
438
|
+
clearTokens() {
|
|
439
|
+
_storage.set(ACCESS_KEY, null);
|
|
440
|
+
_storage.set(REFRESH_KEY, null);
|
|
441
|
+
},
|
|
442
|
+
isAuthenticated() {
|
|
443
|
+
return _storage.get(ACCESS_KEY) !== null;
|
|
444
|
+
},
|
|
445
|
+
// ── API key ───────────────────────────────────────────────────────
|
|
446
|
+
getApiKey() {
|
|
447
|
+
return _apiKeyOverride ?? _storage.get(API_KEY_KEY) ?? defaultApiKey();
|
|
448
|
+
},
|
|
449
|
+
setApiKey(key) {
|
|
450
|
+
_apiKeyOverride = key;
|
|
451
|
+
},
|
|
452
|
+
setApiKeyPersist(key) {
|
|
453
|
+
_apiKeyOverride = key;
|
|
454
|
+
_storage.set(API_KEY_KEY, key);
|
|
455
|
+
},
|
|
456
|
+
clearApiKey() {
|
|
457
|
+
_apiKeyOverride = null;
|
|
458
|
+
_storage.set(API_KEY_KEY, null);
|
|
459
|
+
},
|
|
460
|
+
// ── Locale ────────────────────────────────────────────────────────
|
|
461
|
+
getLocale() {
|
|
462
|
+
return _localeOverride ?? detectLocale();
|
|
463
|
+
},
|
|
464
|
+
setLocale(locale) {
|
|
465
|
+
_localeOverride = locale;
|
|
466
|
+
},
|
|
467
|
+
// ── Base URL ──────────────────────────────────────────────────────
|
|
468
|
+
getBaseUrl() {
|
|
469
|
+
const url = _baseUrlOverride ?? defaultBaseUrl();
|
|
470
|
+
return url.replace(/\/$/, "");
|
|
471
|
+
},
|
|
472
|
+
setBaseUrl(url) {
|
|
473
|
+
_baseUrlOverride = url ? url.replace(/\/$/, "") : null;
|
|
474
|
+
pushClientConfig();
|
|
475
|
+
},
|
|
476
|
+
// ── Credentials toggle ────────────────────────────────────────────
|
|
477
|
+
getWithCredentials() {
|
|
478
|
+
return _withCredentials;
|
|
479
|
+
},
|
|
480
|
+
setWithCredentials(value) {
|
|
481
|
+
_withCredentials = value;
|
|
482
|
+
pushClientConfig();
|
|
483
|
+
},
|
|
484
|
+
// ── 401 handler ───────────────────────────────────────────────────
|
|
485
|
+
onUnauthorized(cb) {
|
|
486
|
+
_onUnauthorized = cb;
|
|
487
|
+
}
|
|
351
488
|
};
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
})
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
const createStream = /* @__PURE__ */ __name(async function* () {
|
|
371
|
-
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
372
|
-
let attempt = 0;
|
|
373
|
-
const signal = options.signal ?? new AbortController().signal;
|
|
374
|
-
while (true) {
|
|
375
|
-
if (signal.aborted) break;
|
|
376
|
-
attempt++;
|
|
377
|
-
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
378
|
-
if (lastEventId !== void 0) {
|
|
379
|
-
headers.set("Last-Event-ID", lastEventId);
|
|
380
|
-
}
|
|
489
|
+
function installAuthOnClient(client2) {
|
|
490
|
+
if (_client) return;
|
|
491
|
+
_client = client2;
|
|
492
|
+
client2.setConfig({
|
|
493
|
+
baseUrl: auth.getBaseUrl(),
|
|
494
|
+
credentials: _withCredentials ? "include" : "same-origin"
|
|
495
|
+
});
|
|
496
|
+
client2.interceptors.request.use((request) => {
|
|
497
|
+
const token = auth.getToken();
|
|
498
|
+
if (token) request.headers.set("Authorization", `Bearer ${token}`);
|
|
499
|
+
const locale = auth.getLocale();
|
|
500
|
+
if (locale) request.headers.set("Accept-Language", locale);
|
|
501
|
+
const apiKey = auth.getApiKey();
|
|
502
|
+
if (apiKey) request.headers.set("X-API-Key", apiKey);
|
|
503
|
+
return request;
|
|
504
|
+
});
|
|
505
|
+
client2.interceptors.response.use((response) => {
|
|
506
|
+
if (response.status === 401 && _onUnauthorized) {
|
|
381
507
|
try {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
...options,
|
|
385
|
-
body: options.serializedBody,
|
|
386
|
-
headers,
|
|
387
|
-
signal
|
|
388
|
-
};
|
|
389
|
-
let request = new Request(url, requestInit);
|
|
390
|
-
if (onRequest) {
|
|
391
|
-
request = await onRequest(url, requestInit);
|
|
392
|
-
}
|
|
393
|
-
const _fetch = options.fetch ?? globalThis.fetch;
|
|
394
|
-
const response = await _fetch(request);
|
|
395
|
-
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
396
|
-
if (!response.body) throw new Error("No body in SSE response");
|
|
397
|
-
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
398
|
-
let buffer = "";
|
|
399
|
-
const abortHandler = /* @__PURE__ */ __name(() => {
|
|
400
|
-
try {
|
|
401
|
-
reader.cancel();
|
|
402
|
-
} catch {
|
|
403
|
-
}
|
|
404
|
-
}, "abortHandler");
|
|
405
|
-
signal.addEventListener("abort", abortHandler);
|
|
406
|
-
try {
|
|
407
|
-
while (true) {
|
|
408
|
-
const { done, value } = await reader.read();
|
|
409
|
-
if (done) break;
|
|
410
|
-
buffer += value;
|
|
411
|
-
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
412
|
-
const chunks = buffer.split("\n\n");
|
|
413
|
-
buffer = chunks.pop() ?? "";
|
|
414
|
-
for (const chunk of chunks) {
|
|
415
|
-
const lines = chunk.split("\n");
|
|
416
|
-
const dataLines = [];
|
|
417
|
-
let eventName;
|
|
418
|
-
for (const line of lines) {
|
|
419
|
-
if (line.startsWith("data:")) {
|
|
420
|
-
dataLines.push(line.replace(/^data:\s*/, ""));
|
|
421
|
-
} else if (line.startsWith("event:")) {
|
|
422
|
-
eventName = line.replace(/^event:\s*/, "");
|
|
423
|
-
} else if (line.startsWith("id:")) {
|
|
424
|
-
lastEventId = line.replace(/^id:\s*/, "");
|
|
425
|
-
} else if (line.startsWith("retry:")) {
|
|
426
|
-
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
|
427
|
-
if (!Number.isNaN(parsed)) {
|
|
428
|
-
retryDelay = parsed;
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
let data;
|
|
433
|
-
let parsedJson = false;
|
|
434
|
-
if (dataLines.length) {
|
|
435
|
-
const rawData = dataLines.join("\n");
|
|
436
|
-
try {
|
|
437
|
-
data = JSON.parse(rawData);
|
|
438
|
-
parsedJson = true;
|
|
439
|
-
} catch {
|
|
440
|
-
data = rawData;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
if (parsedJson) {
|
|
444
|
-
if (responseValidator) {
|
|
445
|
-
await responseValidator(data);
|
|
446
|
-
}
|
|
447
|
-
if (responseTransformer) {
|
|
448
|
-
data = await responseTransformer(data);
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
onSseEvent?.({
|
|
452
|
-
data,
|
|
453
|
-
event: eventName,
|
|
454
|
-
id: lastEventId,
|
|
455
|
-
retry: retryDelay
|
|
456
|
-
});
|
|
457
|
-
if (dataLines.length) {
|
|
458
|
-
yield data;
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
} finally {
|
|
463
|
-
signal.removeEventListener("abort", abortHandler);
|
|
464
|
-
reader.releaseLock();
|
|
465
|
-
}
|
|
466
|
-
break;
|
|
467
|
-
} catch (error) {
|
|
468
|
-
onSseError?.(error);
|
|
469
|
-
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
|
|
470
|
-
break;
|
|
471
|
-
}
|
|
472
|
-
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
|
|
473
|
-
await sleep(backoff);
|
|
508
|
+
_onUnauthorized(response);
|
|
509
|
+
} catch {
|
|
474
510
|
}
|
|
475
511
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
return { stream };
|
|
512
|
+
return response;
|
|
513
|
+
});
|
|
479
514
|
}
|
|
480
|
-
__name(
|
|
515
|
+
__name(installAuthOnClient, "installAuthOnClient");
|
|
481
516
|
|
|
482
|
-
// src/_api/generated/
|
|
483
|
-
var
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
return "%20";
|
|
503
|
-
default:
|
|
504
|
-
return ",";
|
|
505
|
-
}
|
|
506
|
-
}, "separatorArrayNoExplode");
|
|
507
|
-
var separatorObjectExplode = /* @__PURE__ */ __name((style) => {
|
|
508
|
-
switch (style) {
|
|
509
|
-
case "label":
|
|
510
|
-
return ".";
|
|
511
|
-
case "matrix":
|
|
512
|
-
return ";";
|
|
513
|
-
case "simple":
|
|
514
|
-
return ",";
|
|
515
|
-
default:
|
|
516
|
-
return "&";
|
|
517
|
-
}
|
|
518
|
-
}, "separatorObjectExplode");
|
|
519
|
-
var serializeArrayParam = /* @__PURE__ */ __name(({
|
|
520
|
-
allowReserved,
|
|
521
|
-
explode,
|
|
522
|
-
name,
|
|
523
|
-
style,
|
|
524
|
-
value
|
|
525
|
-
}) => {
|
|
526
|
-
if (!explode) {
|
|
527
|
-
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
528
|
-
switch (style) {
|
|
529
|
-
case "label":
|
|
530
|
-
return `.${joinedValues2}`;
|
|
531
|
-
case "matrix":
|
|
532
|
-
return `;${name}=${joinedValues2}`;
|
|
533
|
-
case "simple":
|
|
534
|
-
return joinedValues2;
|
|
535
|
-
default:
|
|
536
|
-
return `${name}=${joinedValues2}`;
|
|
537
|
-
}
|
|
517
|
+
// src/_api/generated/helpers/logger.ts
|
|
518
|
+
var import_consola2 = require("consola");
|
|
519
|
+
var DEFAULT_CONFIG = {
|
|
520
|
+
enabled: typeof process !== "undefined" && process.env.NODE_ENV !== "production",
|
|
521
|
+
logRequests: true,
|
|
522
|
+
logResponses: true,
|
|
523
|
+
logErrors: true,
|
|
524
|
+
logBodies: true,
|
|
525
|
+
logHeaders: false
|
|
526
|
+
};
|
|
527
|
+
var SENSITIVE_HEADERS = [
|
|
528
|
+
"authorization",
|
|
529
|
+
"cookie",
|
|
530
|
+
"set-cookie",
|
|
531
|
+
"x-api-key",
|
|
532
|
+
"x-csrf-token"
|
|
533
|
+
];
|
|
534
|
+
var APILogger = class {
|
|
535
|
+
static {
|
|
536
|
+
__name(this, "APILogger");
|
|
538
537
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
allowReserved,
|
|
546
|
-
name,
|
|
547
|
-
value: v
|
|
538
|
+
config;
|
|
539
|
+
consola;
|
|
540
|
+
constructor(config = {}) {
|
|
541
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
542
|
+
this.consola = config.consola || (0, import_consola2.createConsola)({
|
|
543
|
+
level: this.config.enabled ? 4 : 0
|
|
548
544
|
});
|
|
549
|
-
}).join(separator);
|
|
550
|
-
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
551
|
-
}, "serializeArrayParam");
|
|
552
|
-
var serializePrimitiveParam = /* @__PURE__ */ __name(({
|
|
553
|
-
allowReserved,
|
|
554
|
-
name,
|
|
555
|
-
value
|
|
556
|
-
}) => {
|
|
557
|
-
if (value === void 0 || value === null) {
|
|
558
|
-
return "";
|
|
559
545
|
}
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
"Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
|
|
563
|
-
);
|
|
546
|
+
enable() {
|
|
547
|
+
this.config.enabled = true;
|
|
564
548
|
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
var serializeObjectParam = /* @__PURE__ */ __name(({
|
|
568
|
-
allowReserved,
|
|
569
|
-
explode,
|
|
570
|
-
name,
|
|
571
|
-
style,
|
|
572
|
-
value,
|
|
573
|
-
valueOnly
|
|
574
|
-
}) => {
|
|
575
|
-
if (value instanceof Date) {
|
|
576
|
-
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
549
|
+
disable() {
|
|
550
|
+
this.config.enabled = false;
|
|
577
551
|
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
552
|
+
setConfig(config) {
|
|
553
|
+
this.config = { ...this.config, ...config };
|
|
554
|
+
}
|
|
555
|
+
filterHeaders(headers) {
|
|
556
|
+
if (!headers) return {};
|
|
557
|
+
const filtered = {};
|
|
558
|
+
Object.keys(headers).forEach((key) => {
|
|
559
|
+
filtered[key] = SENSITIVE_HEADERS.includes(key.toLowerCase()) ? "***" : headers[key] || "";
|
|
582
560
|
});
|
|
583
|
-
|
|
584
|
-
switch (style) {
|
|
585
|
-
case "form":
|
|
586
|
-
return `${name}=${joinedValues2}`;
|
|
587
|
-
case "label":
|
|
588
|
-
return `.${joinedValues2}`;
|
|
589
|
-
case "matrix":
|
|
590
|
-
return `;${name}=${joinedValues2}`;
|
|
591
|
-
default:
|
|
592
|
-
return joinedValues2;
|
|
593
|
-
}
|
|
561
|
+
return filtered;
|
|
594
562
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
})
|
|
602
|
-
).join(separator);
|
|
603
|
-
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
604
|
-
}, "serializeObjectParam");
|
|
605
|
-
|
|
606
|
-
// src/_api/generated/core/utils.gen.ts
|
|
607
|
-
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
608
|
-
var defaultPathSerializer = /* @__PURE__ */ __name(({ path, url: _url }) => {
|
|
609
|
-
let url = _url;
|
|
610
|
-
const matches = _url.match(PATH_PARAM_RE);
|
|
611
|
-
if (matches) {
|
|
612
|
-
for (const match of matches) {
|
|
613
|
-
let explode = false;
|
|
614
|
-
let name = match.substring(1, match.length - 1);
|
|
615
|
-
let style = "simple";
|
|
616
|
-
if (name.endsWith("*")) {
|
|
617
|
-
explode = true;
|
|
618
|
-
name = name.substring(0, name.length - 1);
|
|
619
|
-
}
|
|
620
|
-
if (name.startsWith(".")) {
|
|
621
|
-
name = name.substring(1);
|
|
622
|
-
style = "label";
|
|
623
|
-
} else if (name.startsWith(";")) {
|
|
624
|
-
name = name.substring(1);
|
|
625
|
-
style = "matrix";
|
|
626
|
-
}
|
|
627
|
-
const value = path[name];
|
|
628
|
-
if (value === void 0 || value === null) {
|
|
629
|
-
continue;
|
|
630
|
-
}
|
|
631
|
-
if (Array.isArray(value)) {
|
|
632
|
-
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
633
|
-
continue;
|
|
634
|
-
}
|
|
635
|
-
if (typeof value === "object") {
|
|
636
|
-
url = url.replace(
|
|
637
|
-
match,
|
|
638
|
-
serializeObjectParam({
|
|
639
|
-
explode,
|
|
640
|
-
name,
|
|
641
|
-
style,
|
|
642
|
-
value,
|
|
643
|
-
valueOnly: true
|
|
644
|
-
})
|
|
645
|
-
);
|
|
646
|
-
continue;
|
|
647
|
-
}
|
|
648
|
-
if (style === "matrix") {
|
|
649
|
-
url = url.replace(
|
|
650
|
-
match,
|
|
651
|
-
`;${serializePrimitiveParam({
|
|
652
|
-
name,
|
|
653
|
-
value
|
|
654
|
-
})}`
|
|
655
|
-
);
|
|
656
|
-
continue;
|
|
657
|
-
}
|
|
658
|
-
const replaceValue = encodeURIComponent(
|
|
659
|
-
style === "label" ? `.${value}` : value
|
|
660
|
-
);
|
|
661
|
-
url = url.replace(match, replaceValue);
|
|
662
|
-
}
|
|
563
|
+
logRequest(request) {
|
|
564
|
+
if (!this.config.enabled || !this.config.logRequests) return;
|
|
565
|
+
const { method, url, headers, body } = request;
|
|
566
|
+
this.consola.start(`${method} ${url}`);
|
|
567
|
+
if (this.config.logHeaders && headers) this.consola.debug("Headers:", this.filterHeaders(headers));
|
|
568
|
+
if (this.config.logBodies && body) this.consola.debug("Body:", body);
|
|
663
569
|
}
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
querySerializer,
|
|
671
|
-
url: _url
|
|
672
|
-
}) => {
|
|
673
|
-
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
674
|
-
let url = (baseUrl2 ?? "") + pathUrl;
|
|
675
|
-
if (path) {
|
|
676
|
-
url = defaultPathSerializer({ path, url });
|
|
570
|
+
logResponse(request, response) {
|
|
571
|
+
if (!this.config.enabled || !this.config.logResponses) return;
|
|
572
|
+
const { method, url } = request;
|
|
573
|
+
const { status, statusText, data, duration } = response;
|
|
574
|
+
this.consola.success(`${method} ${url} ${status} ${statusText} (${duration}ms)`);
|
|
575
|
+
if (this.config.logBodies && data) this.consola.debug("Response:", data);
|
|
677
576
|
}
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
577
|
+
logError(request, error) {
|
|
578
|
+
if (!this.config.enabled || !this.config.logErrors) return;
|
|
579
|
+
const { method, url } = request;
|
|
580
|
+
const { message, statusCode, fieldErrors, duration } = error;
|
|
581
|
+
this.consola.error(`${method} ${url} ${statusCode || "Network"} Error (${duration}ms)`);
|
|
582
|
+
this.consola.error("Message:", message);
|
|
583
|
+
if (fieldErrors && Object.keys(fieldErrors).length > 0) {
|
|
584
|
+
this.consola.error("Field Errors:");
|
|
585
|
+
Object.entries(fieldErrors).forEach(([field, errors]) => {
|
|
586
|
+
errors.forEach((err) => this.consola.error(` \u2022 ${field}: ${err}`));
|
|
587
|
+
});
|
|
588
|
+
}
|
|
681
589
|
}
|
|
682
|
-
|
|
683
|
-
|
|
590
|
+
info(message, ...args) {
|
|
591
|
+
if (this.config.enabled) this.consola.info(message, ...args);
|
|
684
592
|
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
function getValidRequestBody(options) {
|
|
688
|
-
const hasBody = options.body !== void 0;
|
|
689
|
-
const isSerializedBody = hasBody && options.bodySerializer;
|
|
690
|
-
if (isSerializedBody) {
|
|
691
|
-
if ("serializedBody" in options) {
|
|
692
|
-
const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
|
|
693
|
-
return hasSerializedBody ? options.serializedBody : null;
|
|
694
|
-
}
|
|
695
|
-
return options.body !== "" ? options.body : null;
|
|
593
|
+
warn(message, ...args) {
|
|
594
|
+
if (this.config.enabled) this.consola.warn(message, ...args);
|
|
696
595
|
}
|
|
697
|
-
|
|
698
|
-
|
|
596
|
+
error(message, ...args) {
|
|
597
|
+
if (this.config.enabled) this.consola.error(message, ...args);
|
|
699
598
|
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
__name(getValidRequestBody, "getValidRequestBody");
|
|
703
|
-
|
|
704
|
-
// src/_api/generated/core/auth.gen.ts
|
|
705
|
-
var getAuthToken = /* @__PURE__ */ __name(async (auth, callback) => {
|
|
706
|
-
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
707
|
-
if (!token) {
|
|
708
|
-
return;
|
|
599
|
+
debug(message, ...args) {
|
|
600
|
+
if (this.config.enabled) this.consola.debug(message, ...args);
|
|
709
601
|
}
|
|
710
|
-
|
|
711
|
-
|
|
602
|
+
success(message, ...args) {
|
|
603
|
+
if (this.config.enabled) this.consola.success(message, ...args);
|
|
712
604
|
}
|
|
713
|
-
|
|
714
|
-
return
|
|
605
|
+
withTag(tag) {
|
|
606
|
+
return this.consola.withTag(tag);
|
|
715
607
|
}
|
|
716
|
-
|
|
717
|
-
|
|
608
|
+
};
|
|
609
|
+
var defaultLogger = new APILogger();
|
|
718
610
|
|
|
719
|
-
// src/_api/generated/
|
|
720
|
-
var
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
} = {}) => {
|
|
724
|
-
const querySerializer = /* @__PURE__ */ __name((queryParams) => {
|
|
725
|
-
const search = [];
|
|
726
|
-
if (queryParams && typeof queryParams === "object") {
|
|
727
|
-
for (const name in queryParams) {
|
|
728
|
-
const value = queryParams[name];
|
|
729
|
-
if (value === void 0 || value === null) {
|
|
730
|
-
continue;
|
|
731
|
-
}
|
|
732
|
-
const options = parameters[name] || args;
|
|
733
|
-
if (Array.isArray(value)) {
|
|
734
|
-
const serializedArray = serializeArrayParam({
|
|
735
|
-
allowReserved: options.allowReserved,
|
|
736
|
-
explode: true,
|
|
737
|
-
name,
|
|
738
|
-
style: "form",
|
|
739
|
-
value,
|
|
740
|
-
...options.array
|
|
741
|
-
});
|
|
742
|
-
if (serializedArray) search.push(serializedArray);
|
|
743
|
-
} else if (typeof value === "object") {
|
|
744
|
-
const serializedObject = serializeObjectParam({
|
|
745
|
-
allowReserved: options.allowReserved,
|
|
746
|
-
explode: true,
|
|
747
|
-
name,
|
|
748
|
-
style: "deepObject",
|
|
749
|
-
value,
|
|
750
|
-
...options.object
|
|
751
|
-
});
|
|
752
|
-
if (serializedObject) search.push(serializedObject);
|
|
753
|
-
} else {
|
|
754
|
-
const serializedPrimitive = serializePrimitiveParam({
|
|
755
|
-
allowReserved: options.allowReserved,
|
|
756
|
-
name,
|
|
757
|
-
value
|
|
758
|
-
});
|
|
759
|
-
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
return search.join("&");
|
|
764
|
-
}, "querySerializer");
|
|
765
|
-
return querySerializer;
|
|
766
|
-
}, "createQuerySerializer");
|
|
767
|
-
var getParseAs = /* @__PURE__ */ __name((contentType) => {
|
|
768
|
-
if (!contentType) {
|
|
769
|
-
return "stream";
|
|
611
|
+
// src/_api/generated/_cfg_accounts/api.ts
|
|
612
|
+
var API = class {
|
|
613
|
+
static {
|
|
614
|
+
__name(this, "API");
|
|
770
615
|
}
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
616
|
+
logger;
|
|
617
|
+
constructor(_baseUrl, opts = {}) {
|
|
618
|
+
this.logger = new APILogger(opts.logger);
|
|
619
|
+
if (_baseUrl) auth.setBaseUrl(_baseUrl);
|
|
620
|
+
if (opts.locale !== void 0) auth.setLocale(opts.locale);
|
|
621
|
+
if (opts.apiKey !== void 0) auth.setApiKey(opts.apiKey);
|
|
622
|
+
if (opts.withCredentials !== void 0) auth.setWithCredentials(opts.withCredentials);
|
|
774
623
|
}
|
|
775
|
-
|
|
776
|
-
|
|
624
|
+
// ── Base URL ────────────────────────────────────────────────────────────
|
|
625
|
+
getBaseUrl() {
|
|
626
|
+
return auth.getBaseUrl();
|
|
777
627
|
}
|
|
778
|
-
|
|
779
|
-
|
|
628
|
+
setBaseUrl(url) {
|
|
629
|
+
auth.setBaseUrl(url);
|
|
780
630
|
}
|
|
781
|
-
|
|
782
|
-
|
|
631
|
+
// ── Tokens ──────────────────────────────────────────────────────────────
|
|
632
|
+
getToken() {
|
|
633
|
+
return auth.getToken();
|
|
783
634
|
}
|
|
784
|
-
|
|
785
|
-
|
|
635
|
+
setToken(token) {
|
|
636
|
+
auth.setToken(token);
|
|
786
637
|
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
var checkForExistence = /* @__PURE__ */ __name((options, name) => {
|
|
790
|
-
if (!name) {
|
|
791
|
-
return false;
|
|
638
|
+
getRefreshToken() {
|
|
639
|
+
return auth.getRefreshToken();
|
|
792
640
|
}
|
|
793
|
-
|
|
794
|
-
|
|
641
|
+
setRefreshToken(token) {
|
|
642
|
+
auth.setRefreshToken(token);
|
|
795
643
|
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
var setAuthParams = /* @__PURE__ */ __name(async ({
|
|
799
|
-
security,
|
|
800
|
-
...options
|
|
801
|
-
}) => {
|
|
802
|
-
for (const auth of security) {
|
|
803
|
-
if (checkForExistence(options, auth.name)) {
|
|
804
|
-
continue;
|
|
805
|
-
}
|
|
806
|
-
const token = await getAuthToken(auth, options.auth);
|
|
807
|
-
if (!token) {
|
|
808
|
-
continue;
|
|
809
|
-
}
|
|
810
|
-
const name = auth.name ?? "Authorization";
|
|
811
|
-
switch (auth.in) {
|
|
812
|
-
case "query":
|
|
813
|
-
if (!options.query) {
|
|
814
|
-
options.query = {};
|
|
815
|
-
}
|
|
816
|
-
options.query[name] = token;
|
|
817
|
-
break;
|
|
818
|
-
case "cookie":
|
|
819
|
-
options.headers.append("Cookie", `${name}=${token}`);
|
|
820
|
-
break;
|
|
821
|
-
case "header":
|
|
822
|
-
default:
|
|
823
|
-
options.headers.set(name, token);
|
|
824
|
-
break;
|
|
825
|
-
}
|
|
644
|
+
clearToken() {
|
|
645
|
+
auth.clearTokens();
|
|
826
646
|
}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
baseUrl: options.baseUrl,
|
|
830
|
-
path: options.path,
|
|
831
|
-
query: options.query,
|
|
832
|
-
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
833
|
-
url: options.url
|
|
834
|
-
}), "buildUrl");
|
|
835
|
-
var mergeConfigs = /* @__PURE__ */ __name((a, b) => {
|
|
836
|
-
const config = { ...a, ...b };
|
|
837
|
-
if (config.baseUrl?.endsWith("/")) {
|
|
838
|
-
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
647
|
+
isAuthenticated() {
|
|
648
|
+
return auth.isAuthenticated();
|
|
839
649
|
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
var headersEntries = /* @__PURE__ */ __name((headers) => {
|
|
844
|
-
const entries = [];
|
|
845
|
-
headers.forEach((value, key) => {
|
|
846
|
-
entries.push([key, value]);
|
|
847
|
-
});
|
|
848
|
-
return entries;
|
|
849
|
-
}, "headersEntries");
|
|
850
|
-
var mergeHeaders = /* @__PURE__ */ __name((...headers) => {
|
|
851
|
-
const mergedHeaders = new Headers();
|
|
852
|
-
for (const header of headers) {
|
|
853
|
-
if (!header) {
|
|
854
|
-
continue;
|
|
855
|
-
}
|
|
856
|
-
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
857
|
-
for (const [key, value] of iterator) {
|
|
858
|
-
if (value === null) {
|
|
859
|
-
mergedHeaders.delete(key);
|
|
860
|
-
} else if (Array.isArray(value)) {
|
|
861
|
-
for (const v of value) {
|
|
862
|
-
mergedHeaders.append(key, v);
|
|
863
|
-
}
|
|
864
|
-
} else if (value !== void 0) {
|
|
865
|
-
mergedHeaders.set(
|
|
866
|
-
key,
|
|
867
|
-
typeof value === "object" ? JSON.stringify(value) : value
|
|
868
|
-
);
|
|
869
|
-
}
|
|
870
|
-
}
|
|
650
|
+
// ── Locale / API key ────────────────────────────────────────────────────
|
|
651
|
+
getLocale() {
|
|
652
|
+
return auth.getLocale();
|
|
871
653
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
var Interceptors = class {
|
|
875
|
-
static {
|
|
876
|
-
__name(this, "Interceptors");
|
|
654
|
+
setLocale(locale) {
|
|
655
|
+
auth.setLocale(locale);
|
|
877
656
|
}
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
this.fns = [];
|
|
657
|
+
getApiKey() {
|
|
658
|
+
return auth.getApiKey();
|
|
881
659
|
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
if (this.fns[index]) {
|
|
885
|
-
this.fns[index] = null;
|
|
886
|
-
}
|
|
660
|
+
setApiKey(key) {
|
|
661
|
+
auth.setApiKey(key);
|
|
887
662
|
}
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
663
|
+
};
|
|
664
|
+
|
|
665
|
+
// src/_api/generated/helpers/errors.ts
|
|
666
|
+
var APIError = class extends Error {
|
|
667
|
+
constructor(statusCode, statusText, response, url, message) {
|
|
668
|
+
super(message || `HTTP ${statusCode}: ${statusText}`);
|
|
669
|
+
this.statusCode = statusCode;
|
|
670
|
+
this.statusText = statusText;
|
|
671
|
+
this.response = response;
|
|
672
|
+
this.url = url;
|
|
673
|
+
this.name = "APIError";
|
|
891
674
|
}
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
675
|
+
static {
|
|
676
|
+
__name(this, "APIError");
|
|
677
|
+
}
|
|
678
|
+
get details() {
|
|
679
|
+
if (typeof this.response === "object" && this.response !== null) {
|
|
680
|
+
return this.response;
|
|
895
681
|
}
|
|
896
|
-
return
|
|
682
|
+
return null;
|
|
897
683
|
}
|
|
898
|
-
|
|
899
|
-
const
|
|
900
|
-
if (
|
|
901
|
-
|
|
902
|
-
|
|
684
|
+
get fieldErrors() {
|
|
685
|
+
const details = this.details;
|
|
686
|
+
if (!details) return null;
|
|
687
|
+
const fieldErrors = {};
|
|
688
|
+
for (const [key, value] of Object.entries(details)) {
|
|
689
|
+
if (Array.isArray(value)) fieldErrors[key] = value;
|
|
903
690
|
}
|
|
904
|
-
return
|
|
691
|
+
return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
|
|
905
692
|
}
|
|
906
|
-
|
|
907
|
-
this.
|
|
908
|
-
return this.
|
|
693
|
+
get errorMessage() {
|
|
694
|
+
const details = this.details;
|
|
695
|
+
if (!details) return this.message;
|
|
696
|
+
if (details.detail) {
|
|
697
|
+
return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
|
|
698
|
+
}
|
|
699
|
+
if (details.error) return String(details.error);
|
|
700
|
+
if (details.message) return String(details.message);
|
|
701
|
+
const fieldErrors = this.fieldErrors;
|
|
702
|
+
if (fieldErrors) {
|
|
703
|
+
const firstField = Object.keys(fieldErrors)[0];
|
|
704
|
+
if (firstField) return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
|
|
705
|
+
}
|
|
706
|
+
return this.message;
|
|
909
707
|
}
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
style: "deepObject"
|
|
708
|
+
get isValidationError() {
|
|
709
|
+
return this.statusCode === 400;
|
|
710
|
+
}
|
|
711
|
+
get isAuthError() {
|
|
712
|
+
return this.statusCode === 401;
|
|
713
|
+
}
|
|
714
|
+
get isPermissionError() {
|
|
715
|
+
return this.statusCode === 403;
|
|
716
|
+
}
|
|
717
|
+
get isNotFoundError() {
|
|
718
|
+
return this.statusCode === 404;
|
|
719
|
+
}
|
|
720
|
+
get isServerError() {
|
|
721
|
+
return this.statusCode >= 500 && this.statusCode < 600;
|
|
925
722
|
}
|
|
926
|
-
});
|
|
927
|
-
var defaultHeaders = {
|
|
928
|
-
"Content-Type": "application/json"
|
|
929
723
|
};
|
|
930
|
-
var createConfig = /* @__PURE__ */ __name((override = {}) => ({
|
|
931
|
-
...jsonBodySerializer,
|
|
932
|
-
headers: defaultHeaders,
|
|
933
|
-
parseAs: "auto",
|
|
934
|
-
querySerializer: defaultQuerySerializer,
|
|
935
|
-
...override
|
|
936
|
-
}), "createConfig");
|
|
937
724
|
|
|
938
|
-
// src/_api/generated/
|
|
939
|
-
var
|
|
940
|
-
let _config = mergeConfigs(createConfig(), config);
|
|
941
|
-
const getConfig = /* @__PURE__ */ __name(() => ({ ..._config }), "getConfig");
|
|
942
|
-
const setConfig = /* @__PURE__ */ __name((config2) => {
|
|
943
|
-
_config = mergeConfigs(_config, config2);
|
|
944
|
-
return getConfig();
|
|
945
|
-
}, "setConfig");
|
|
946
|
-
const interceptors = createInterceptors();
|
|
947
|
-
const beforeRequest = /* @__PURE__ */ __name(async (options) => {
|
|
948
|
-
const opts = {
|
|
949
|
-
..._config,
|
|
950
|
-
...options,
|
|
951
|
-
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
952
|
-
headers: mergeHeaders(_config.headers, options.headers),
|
|
953
|
-
serializedBody: void 0
|
|
954
|
-
};
|
|
955
|
-
if (opts.security) {
|
|
956
|
-
await setAuthParams({
|
|
957
|
-
...opts,
|
|
958
|
-
security: opts.security
|
|
959
|
-
});
|
|
960
|
-
}
|
|
961
|
-
if (opts.requestValidator) {
|
|
962
|
-
await opts.requestValidator(opts);
|
|
963
|
-
}
|
|
964
|
-
if (opts.body !== void 0 && opts.bodySerializer) {
|
|
965
|
-
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
966
|
-
}
|
|
967
|
-
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
968
|
-
opts.headers.delete("Content-Type");
|
|
969
|
-
}
|
|
970
|
-
const resolvedOpts = opts;
|
|
971
|
-
const url = buildUrl(resolvedOpts);
|
|
972
|
-
return { opts: resolvedOpts, url };
|
|
973
|
-
}, "beforeRequest");
|
|
974
|
-
const request = /* @__PURE__ */ __name(async (options) => {
|
|
975
|
-
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
976
|
-
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
977
|
-
let request2;
|
|
978
|
-
let response;
|
|
979
|
-
try {
|
|
980
|
-
const { opts, url } = await beforeRequest(options);
|
|
981
|
-
const requestInit = {
|
|
982
|
-
redirect: "follow",
|
|
983
|
-
...opts,
|
|
984
|
-
body: getValidRequestBody(opts)
|
|
985
|
-
};
|
|
986
|
-
request2 = new Request(url, requestInit);
|
|
987
|
-
for (const fn of interceptors.request.fns) {
|
|
988
|
-
if (fn) {
|
|
989
|
-
request2 = await fn(request2, opts);
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
const _fetch = opts.fetch;
|
|
993
|
-
response = await _fetch(request2);
|
|
994
|
-
for (const fn of interceptors.response.fns) {
|
|
995
|
-
if (fn) {
|
|
996
|
-
response = await fn(response, request2, opts);
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
const result = {
|
|
1000
|
-
request: request2,
|
|
1001
|
-
response
|
|
1002
|
-
};
|
|
1003
|
-
if (response.ok) {
|
|
1004
|
-
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
1005
|
-
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
1006
|
-
let emptyData;
|
|
1007
|
-
switch (parseAs) {
|
|
1008
|
-
case "arrayBuffer":
|
|
1009
|
-
case "blob":
|
|
1010
|
-
case "text":
|
|
1011
|
-
emptyData = await response[parseAs]();
|
|
1012
|
-
break;
|
|
1013
|
-
case "formData":
|
|
1014
|
-
emptyData = new FormData();
|
|
1015
|
-
break;
|
|
1016
|
-
case "stream":
|
|
1017
|
-
emptyData = response.body;
|
|
1018
|
-
break;
|
|
1019
|
-
case "json":
|
|
1020
|
-
default:
|
|
1021
|
-
emptyData = {};
|
|
1022
|
-
break;
|
|
1023
|
-
}
|
|
1024
|
-
return opts.responseStyle === "data" ? emptyData : {
|
|
1025
|
-
data: emptyData,
|
|
1026
|
-
...result
|
|
1027
|
-
};
|
|
1028
|
-
}
|
|
1029
|
-
let data;
|
|
1030
|
-
switch (parseAs) {
|
|
1031
|
-
case "arrayBuffer":
|
|
1032
|
-
case "blob":
|
|
1033
|
-
case "formData":
|
|
1034
|
-
case "text":
|
|
1035
|
-
data = await response[parseAs]();
|
|
1036
|
-
break;
|
|
1037
|
-
case "json": {
|
|
1038
|
-
const text = await response.text();
|
|
1039
|
-
data = text ? JSON.parse(text) : {};
|
|
1040
|
-
break;
|
|
1041
|
-
}
|
|
1042
|
-
case "stream":
|
|
1043
|
-
return opts.responseStyle === "data" ? response.body : {
|
|
1044
|
-
data: response.body,
|
|
1045
|
-
...result
|
|
1046
|
-
};
|
|
1047
|
-
}
|
|
1048
|
-
if (parseAs === "json") {
|
|
1049
|
-
if (opts.responseValidator) {
|
|
1050
|
-
await opts.responseValidator(data);
|
|
1051
|
-
}
|
|
1052
|
-
if (opts.responseTransformer) {
|
|
1053
|
-
data = await opts.responseTransformer(data);
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
return opts.responseStyle === "data" ? data : {
|
|
1057
|
-
data,
|
|
1058
|
-
...result
|
|
1059
|
-
};
|
|
1060
|
-
}
|
|
1061
|
-
const textError = await response.text();
|
|
1062
|
-
let jsonError;
|
|
1063
|
-
try {
|
|
1064
|
-
jsonError = JSON.parse(textError);
|
|
1065
|
-
} catch {
|
|
1066
|
-
}
|
|
1067
|
-
throw jsonError ?? textError;
|
|
1068
|
-
} catch (error) {
|
|
1069
|
-
let finalError = error;
|
|
1070
|
-
for (const fn of interceptors.error.fns) {
|
|
1071
|
-
if (fn) {
|
|
1072
|
-
finalError = await fn(finalError, response, request2, options);
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
finalError = finalError || {};
|
|
1076
|
-
if (throwOnError) {
|
|
1077
|
-
throw finalError;
|
|
1078
|
-
}
|
|
1079
|
-
return responseStyle === "data" ? void 0 : {
|
|
1080
|
-
error: finalError,
|
|
1081
|
-
request: request2,
|
|
1082
|
-
response
|
|
1083
|
-
};
|
|
1084
|
-
}
|
|
1085
|
-
}, "request");
|
|
1086
|
-
const makeMethodFn = /* @__PURE__ */ __name((method) => (options) => request({ ...options, method }), "makeMethodFn");
|
|
1087
|
-
const makeSseFn = /* @__PURE__ */ __name((method) => async (options) => {
|
|
1088
|
-
const { opts, url } = await beforeRequest(options);
|
|
1089
|
-
return createSseClient({
|
|
1090
|
-
...opts,
|
|
1091
|
-
body: opts.body,
|
|
1092
|
-
method,
|
|
1093
|
-
onRequest: /* @__PURE__ */ __name(async (url2, init) => {
|
|
1094
|
-
let request2 = new Request(url2, init);
|
|
1095
|
-
for (const fn of interceptors.request.fns) {
|
|
1096
|
-
if (fn) {
|
|
1097
|
-
request2 = await fn(request2, opts);
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
return request2;
|
|
1101
|
-
}, "onRequest"),
|
|
1102
|
-
serializedBody: getValidRequestBody(opts),
|
|
1103
|
-
url
|
|
1104
|
-
});
|
|
1105
|
-
}, "makeSseFn");
|
|
1106
|
-
const _buildUrl = /* @__PURE__ */ __name((options) => buildUrl({ ..._config, ...options }), "_buildUrl");
|
|
1107
|
-
return {
|
|
1108
|
-
buildUrl: _buildUrl,
|
|
1109
|
-
connect: makeMethodFn("CONNECT"),
|
|
1110
|
-
delete: makeMethodFn("DELETE"),
|
|
1111
|
-
get: makeMethodFn("GET"),
|
|
1112
|
-
getConfig,
|
|
1113
|
-
head: makeMethodFn("HEAD"),
|
|
1114
|
-
interceptors,
|
|
1115
|
-
options: makeMethodFn("OPTIONS"),
|
|
1116
|
-
patch: makeMethodFn("PATCH"),
|
|
1117
|
-
post: makeMethodFn("POST"),
|
|
1118
|
-
put: makeMethodFn("PUT"),
|
|
1119
|
-
request,
|
|
1120
|
-
setConfig,
|
|
1121
|
-
sse: {
|
|
1122
|
-
connect: makeSseFn("CONNECT"),
|
|
1123
|
-
delete: makeSseFn("DELETE"),
|
|
1124
|
-
get: makeSseFn("GET"),
|
|
1125
|
-
head: makeSseFn("HEAD"),
|
|
1126
|
-
options: makeSseFn("OPTIONS"),
|
|
1127
|
-
patch: makeSseFn("PATCH"),
|
|
1128
|
-
post: makeSseFn("POST"),
|
|
1129
|
-
put: makeSseFn("PUT"),
|
|
1130
|
-
trace: makeSseFn("TRACE")
|
|
1131
|
-
},
|
|
1132
|
-
trace: makeMethodFn("TRACE")
|
|
1133
|
-
};
|
|
1134
|
-
}, "createClient");
|
|
1135
|
-
|
|
1136
|
-
// src/_api/generated/client.gen.ts
|
|
1137
|
-
var client = createClient(createConfig({ baseUrl: "http://localhost:8000" }));
|
|
1138
|
-
|
|
1139
|
-
// src/_api/generated/helpers/storage.ts
|
|
1140
|
-
var LocalStorageAdapter = class {
|
|
725
|
+
// src/_api/generated/_cfg_centrifugo/api.ts
|
|
726
|
+
var API2 = class {
|
|
1141
727
|
static {
|
|
1142
|
-
__name(this, "
|
|
728
|
+
__name(this, "API");
|
|
1143
729
|
}
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
730
|
+
logger;
|
|
731
|
+
constructor(_baseUrl, opts = {}) {
|
|
732
|
+
this.logger = new APILogger(opts.logger);
|
|
733
|
+
if (_baseUrl) auth.setBaseUrl(_baseUrl);
|
|
734
|
+
if (opts.locale !== void 0) auth.setLocale(opts.locale);
|
|
735
|
+
if (opts.apiKey !== void 0) auth.setApiKey(opts.apiKey);
|
|
736
|
+
if (opts.withCredentials !== void 0) auth.setWithCredentials(opts.withCredentials);
|
|
1151
737
|
}
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
window.localStorage.setItem(key, value);
|
|
1156
|
-
} catch {
|
|
1157
|
-
}
|
|
738
|
+
// ── Base URL ────────────────────────────────────────────────────────────
|
|
739
|
+
getBaseUrl() {
|
|
740
|
+
return auth.getBaseUrl();
|
|
1158
741
|
}
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
try {
|
|
1162
|
-
window.localStorage.removeItem(key);
|
|
1163
|
-
} catch {
|
|
1164
|
-
}
|
|
742
|
+
setBaseUrl(url) {
|
|
743
|
+
auth.setBaseUrl(url);
|
|
1165
744
|
}
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
window.localStorage.clear();
|
|
1170
|
-
} catch {
|
|
1171
|
-
}
|
|
745
|
+
// ── Tokens ──────────────────────────────────────────────────────────────
|
|
746
|
+
getToken() {
|
|
747
|
+
return auth.getToken();
|
|
1172
748
|
}
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
749
|
+
setToken(token) {
|
|
750
|
+
auth.setToken(token);
|
|
751
|
+
}
|
|
752
|
+
getRefreshToken() {
|
|
753
|
+
return auth.getRefreshToken();
|
|
754
|
+
}
|
|
755
|
+
setRefreshToken(token) {
|
|
756
|
+
auth.setRefreshToken(token);
|
|
757
|
+
}
|
|
758
|
+
clearToken() {
|
|
759
|
+
auth.clearTokens();
|
|
760
|
+
}
|
|
761
|
+
isAuthenticated() {
|
|
762
|
+
return auth.isAuthenticated();
|
|
763
|
+
}
|
|
764
|
+
// ── Locale / API key ────────────────────────────────────────────────────
|
|
765
|
+
getLocale() {
|
|
766
|
+
return auth.getLocale();
|
|
767
|
+
}
|
|
768
|
+
setLocale(locale) {
|
|
769
|
+
auth.setLocale(locale);
|
|
770
|
+
}
|
|
771
|
+
getApiKey() {
|
|
772
|
+
return auth.getApiKey();
|
|
773
|
+
}
|
|
774
|
+
setApiKey(key) {
|
|
775
|
+
auth.setApiKey(key);
|
|
776
|
+
}
|
|
777
|
+
};
|
|
778
|
+
|
|
779
|
+
// src/_api/generated/_cfg_totp/api.ts
|
|
780
|
+
var API3 = class {
|
|
1193
781
|
static {
|
|
1194
|
-
__name(this, "
|
|
782
|
+
__name(this, "API");
|
|
1195
783
|
}
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
784
|
+
logger;
|
|
785
|
+
constructor(_baseUrl, opts = {}) {
|
|
786
|
+
this.logger = new APILogger(opts.logger);
|
|
787
|
+
if (_baseUrl) auth.setBaseUrl(_baseUrl);
|
|
788
|
+
if (opts.locale !== void 0) auth.setLocale(opts.locale);
|
|
789
|
+
if (opts.apiKey !== void 0) auth.setApiKey(opts.apiKey);
|
|
790
|
+
if (opts.withCredentials !== void 0) auth.setWithCredentials(opts.withCredentials);
|
|
1203
791
|
}
|
|
1204
|
-
|
|
1205
|
-
|
|
792
|
+
// ── Base URL ────────────────────────────────────────────────────────────
|
|
793
|
+
getBaseUrl() {
|
|
794
|
+
return auth.getBaseUrl();
|
|
1206
795
|
}
|
|
1207
|
-
|
|
1208
|
-
|
|
796
|
+
setBaseUrl(url) {
|
|
797
|
+
auth.setBaseUrl(url);
|
|
1209
798
|
}
|
|
1210
|
-
|
|
1211
|
-
|
|
799
|
+
// ── Tokens ──────────────────────────────────────────────────────────────
|
|
800
|
+
getToken() {
|
|
801
|
+
return auth.getToken();
|
|
1212
802
|
}
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
const filtered = {};
|
|
1216
|
-
Object.keys(headers).forEach((key) => {
|
|
1217
|
-
filtered[key] = SENSITIVE_HEADERS.includes(key.toLowerCase()) ? "***" : headers[key] || "";
|
|
1218
|
-
});
|
|
1219
|
-
return filtered;
|
|
803
|
+
setToken(token) {
|
|
804
|
+
auth.setToken(token);
|
|
1220
805
|
}
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
const { method, url, headers, body } = request;
|
|
1224
|
-
this.consola.start(`${method} ${url}`);
|
|
1225
|
-
if (this.config.logHeaders && headers) this.consola.debug("Headers:", this.filterHeaders(headers));
|
|
1226
|
-
if (this.config.logBodies && body) this.consola.debug("Body:", body);
|
|
806
|
+
getRefreshToken() {
|
|
807
|
+
return auth.getRefreshToken();
|
|
1227
808
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
const { method, url } = request;
|
|
1231
|
-
const { status, statusText, data, duration } = response;
|
|
1232
|
-
this.consola.success(`${method} ${url} ${status} ${statusText} (${duration}ms)`);
|
|
1233
|
-
if (this.config.logBodies && data) this.consola.debug("Response:", data);
|
|
809
|
+
setRefreshToken(token) {
|
|
810
|
+
auth.setRefreshToken(token);
|
|
1234
811
|
}
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
const { method, url } = request;
|
|
1238
|
-
const { message, statusCode, fieldErrors, duration } = error;
|
|
1239
|
-
this.consola.error(`${method} ${url} ${statusCode || "Network"} Error (${duration}ms)`);
|
|
1240
|
-
this.consola.error("Message:", message);
|
|
1241
|
-
if (fieldErrors && Object.keys(fieldErrors).length > 0) {
|
|
1242
|
-
this.consola.error("Field Errors:");
|
|
1243
|
-
Object.entries(fieldErrors).forEach(([field, errors]) => {
|
|
1244
|
-
errors.forEach((err) => this.consola.error(` \u2022 ${field}: ${err}`));
|
|
1245
|
-
});
|
|
1246
|
-
}
|
|
812
|
+
clearToken() {
|
|
813
|
+
auth.clearTokens();
|
|
1247
814
|
}
|
|
1248
|
-
|
|
1249
|
-
|
|
815
|
+
isAuthenticated() {
|
|
816
|
+
return auth.isAuthenticated();
|
|
1250
817
|
}
|
|
1251
|
-
|
|
1252
|
-
|
|
818
|
+
// ── Locale / API key ────────────────────────────────────────────────────
|
|
819
|
+
getLocale() {
|
|
820
|
+
return auth.getLocale();
|
|
1253
821
|
}
|
|
1254
|
-
|
|
1255
|
-
|
|
822
|
+
setLocale(locale) {
|
|
823
|
+
auth.setLocale(locale);
|
|
1256
824
|
}
|
|
1257
|
-
|
|
1258
|
-
|
|
825
|
+
getApiKey() {
|
|
826
|
+
return auth.getApiKey();
|
|
1259
827
|
}
|
|
1260
|
-
|
|
1261
|
-
|
|
828
|
+
setApiKey(key) {
|
|
829
|
+
auth.setApiKey(key);
|
|
1262
830
|
}
|
|
1263
|
-
|
|
1264
|
-
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
// src/_api/generated/index.ts
|
|
834
|
+
var CfgAccountsApi = new API();
|
|
835
|
+
var CfgCentrifugoApi = new API2();
|
|
836
|
+
var CfgTotpApi = new API3();
|
|
837
|
+
|
|
838
|
+
// src/_api/generated/core/bodySerializer.gen.ts
|
|
839
|
+
var serializeFormDataPair = /* @__PURE__ */ __name((data, key, value) => {
|
|
840
|
+
if (typeof value === "string" || value instanceof Blob) {
|
|
841
|
+
data.append(key, value);
|
|
842
|
+
} else if (value instanceof Date) {
|
|
843
|
+
data.append(key, value.toISOString());
|
|
844
|
+
} else {
|
|
845
|
+
data.append(key, JSON.stringify(value));
|
|
1265
846
|
}
|
|
847
|
+
}, "serializeFormDataPair");
|
|
848
|
+
var formDataBodySerializer = {
|
|
849
|
+
bodySerializer: /* @__PURE__ */ __name((body) => {
|
|
850
|
+
const data = new FormData();
|
|
851
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
852
|
+
if (value === void 0 || value === null) {
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
if (Array.isArray(value)) {
|
|
856
|
+
value.forEach((v) => serializeFormDataPair(data, key, v));
|
|
857
|
+
} else {
|
|
858
|
+
serializeFormDataPair(data, key, value);
|
|
859
|
+
}
|
|
860
|
+
});
|
|
861
|
+
return data;
|
|
862
|
+
}, "bodySerializer")
|
|
863
|
+
};
|
|
864
|
+
var jsonBodySerializer = {
|
|
865
|
+
bodySerializer: /* @__PURE__ */ __name((body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value), "bodySerializer")
|
|
1266
866
|
};
|
|
1267
|
-
var defaultLogger = new APILogger();
|
|
1268
867
|
|
|
1269
|
-
// src/_api/generated/
|
|
1270
|
-
var
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
868
|
+
// src/_api/generated/core/params.gen.ts
|
|
869
|
+
var extraPrefixesMap = {
|
|
870
|
+
$body_: "body",
|
|
871
|
+
$headers_: "headers",
|
|
872
|
+
$path_: "path",
|
|
873
|
+
$query_: "query"
|
|
874
|
+
};
|
|
875
|
+
var extraPrefixes = Object.entries(extraPrefixesMap);
|
|
876
|
+
|
|
877
|
+
// src/_api/generated/core/serverSentEvents.gen.ts
|
|
878
|
+
function createSseClient({
|
|
879
|
+
onRequest,
|
|
880
|
+
onSseError,
|
|
881
|
+
onSseEvent,
|
|
882
|
+
responseTransformer,
|
|
883
|
+
responseValidator,
|
|
884
|
+
sseDefaultRetryDelay,
|
|
885
|
+
sseMaxRetryAttempts,
|
|
886
|
+
sseMaxRetryDelay,
|
|
887
|
+
sseSleepFn,
|
|
888
|
+
url,
|
|
889
|
+
...options
|
|
890
|
+
}) {
|
|
891
|
+
let lastEventId;
|
|
892
|
+
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
893
|
+
const createStream = /* @__PURE__ */ __name(async function* () {
|
|
894
|
+
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
895
|
+
let attempt = 0;
|
|
896
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
897
|
+
while (true) {
|
|
898
|
+
if (signal.aborted) break;
|
|
899
|
+
attempt++;
|
|
900
|
+
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
901
|
+
if (lastEventId !== void 0) {
|
|
902
|
+
headers.set("Last-Event-ID", lastEventId);
|
|
903
|
+
}
|
|
904
|
+
try {
|
|
905
|
+
const requestInit = {
|
|
906
|
+
redirect: "follow",
|
|
907
|
+
...options,
|
|
908
|
+
body: options.serializedBody,
|
|
909
|
+
headers,
|
|
910
|
+
signal
|
|
911
|
+
};
|
|
912
|
+
let request = new Request(url, requestInit);
|
|
913
|
+
if (onRequest) {
|
|
914
|
+
request = await onRequest(url, requestInit);
|
|
915
|
+
}
|
|
916
|
+
const _fetch = options.fetch ?? globalThis.fetch;
|
|
917
|
+
const response = await _fetch(request);
|
|
918
|
+
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
919
|
+
if (!response.body) throw new Error("No body in SSE response");
|
|
920
|
+
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
921
|
+
let buffer = "";
|
|
922
|
+
const abortHandler = /* @__PURE__ */ __name(() => {
|
|
923
|
+
try {
|
|
924
|
+
reader.cancel();
|
|
925
|
+
} catch {
|
|
926
|
+
}
|
|
927
|
+
}, "abortHandler");
|
|
928
|
+
signal.addEventListener("abort", abortHandler);
|
|
929
|
+
try {
|
|
930
|
+
while (true) {
|
|
931
|
+
const { done, value } = await reader.read();
|
|
932
|
+
if (done) break;
|
|
933
|
+
buffer += value;
|
|
934
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
935
|
+
const chunks = buffer.split("\n\n");
|
|
936
|
+
buffer = chunks.pop() ?? "";
|
|
937
|
+
for (const chunk of chunks) {
|
|
938
|
+
const lines = chunk.split("\n");
|
|
939
|
+
const dataLines = [];
|
|
940
|
+
let eventName;
|
|
941
|
+
for (const line of lines) {
|
|
942
|
+
if (line.startsWith("data:")) {
|
|
943
|
+
dataLines.push(line.replace(/^data:\s*/, ""));
|
|
944
|
+
} else if (line.startsWith("event:")) {
|
|
945
|
+
eventName = line.replace(/^event:\s*/, "");
|
|
946
|
+
} else if (line.startsWith("id:")) {
|
|
947
|
+
lastEventId = line.replace(/^id:\s*/, "");
|
|
948
|
+
} else if (line.startsWith("retry:")) {
|
|
949
|
+
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
|
950
|
+
if (!Number.isNaN(parsed)) {
|
|
951
|
+
retryDelay = parsed;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
let data;
|
|
956
|
+
let parsedJson = false;
|
|
957
|
+
if (dataLines.length) {
|
|
958
|
+
const rawData = dataLines.join("\n");
|
|
959
|
+
try {
|
|
960
|
+
data = JSON.parse(rawData);
|
|
961
|
+
parsedJson = true;
|
|
962
|
+
} catch {
|
|
963
|
+
data = rawData;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
if (parsedJson) {
|
|
967
|
+
if (responseValidator) {
|
|
968
|
+
await responseValidator(data);
|
|
969
|
+
}
|
|
970
|
+
if (responseTransformer) {
|
|
971
|
+
data = await responseTransformer(data);
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
onSseEvent?.({
|
|
975
|
+
data,
|
|
976
|
+
event: eventName,
|
|
977
|
+
id: lastEventId,
|
|
978
|
+
retry: retryDelay
|
|
979
|
+
});
|
|
980
|
+
if (dataLines.length) {
|
|
981
|
+
yield data;
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
} finally {
|
|
986
|
+
signal.removeEventListener("abort", abortHandler);
|
|
987
|
+
reader.releaseLock();
|
|
988
|
+
}
|
|
989
|
+
break;
|
|
990
|
+
} catch (error) {
|
|
991
|
+
onSseError?.(error);
|
|
992
|
+
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
|
|
993
|
+
break;
|
|
994
|
+
}
|
|
995
|
+
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
|
|
996
|
+
await sleep(backoff);
|
|
997
|
+
}
|
|
1280
998
|
}
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
return
|
|
999
|
+
}, "createStream");
|
|
1000
|
+
const stream = createStream();
|
|
1001
|
+
return { stream };
|
|
1284
1002
|
}
|
|
1285
|
-
__name(
|
|
1286
|
-
var API = class {
|
|
1287
|
-
static {
|
|
1288
|
-
__name(this, "API");
|
|
1289
|
-
}
|
|
1290
|
-
baseUrl;
|
|
1291
|
-
storage;
|
|
1292
|
-
locale;
|
|
1293
|
-
apiKey;
|
|
1294
|
-
logger;
|
|
1295
|
-
constructor(baseUrl2, opts = {}) {
|
|
1296
|
-
this.baseUrl = baseUrl2.replace(/\/$/, "");
|
|
1297
|
-
this.storage = opts.storage ?? new LocalStorageAdapter();
|
|
1298
|
-
this.logger = new APILogger(opts.logger);
|
|
1299
|
-
this.locale = opts.locale ?? null;
|
|
1300
|
-
this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
|
|
1301
|
-
const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
|
|
1302
|
-
client.setConfig({ baseUrl: this.baseUrl, credentials });
|
|
1303
|
-
client.interceptors.request.use((request) => {
|
|
1304
|
-
const access = this.getToken();
|
|
1305
|
-
if (access) request.headers.set("Authorization", `Bearer ${access}`);
|
|
1306
|
-
const locale = this.locale ?? detectLocale();
|
|
1307
|
-
if (locale) request.headers.set("Accept-Language", locale);
|
|
1308
|
-
if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
|
|
1309
|
-
return request;
|
|
1310
|
-
});
|
|
1311
|
-
}
|
|
1312
|
-
// ── Base URL ────────────────────────────────────────────────────────────
|
|
1313
|
-
getBaseUrl() {
|
|
1314
|
-
return this.baseUrl;
|
|
1315
|
-
}
|
|
1316
|
-
setBaseUrl(url) {
|
|
1317
|
-
this.baseUrl = url.replace(/\/$/, "");
|
|
1318
|
-
client.setConfig({ baseUrl: this.baseUrl });
|
|
1319
|
-
}
|
|
1320
|
-
// ── Tokens ──────────────────────────────────────────────────────────────
|
|
1321
|
-
getToken() {
|
|
1322
|
-
return this.storage.getItem(ACCESS_KEY);
|
|
1323
|
-
}
|
|
1324
|
-
setToken(token) {
|
|
1325
|
-
if (token) this.storage.setItem(ACCESS_KEY, token);
|
|
1326
|
-
else this.storage.removeItem(ACCESS_KEY);
|
|
1327
|
-
}
|
|
1328
|
-
getRefreshToken() {
|
|
1329
|
-
return this.storage.getItem(REFRESH_KEY);
|
|
1330
|
-
}
|
|
1331
|
-
setRefreshToken(token) {
|
|
1332
|
-
if (token) this.storage.setItem(REFRESH_KEY, token);
|
|
1333
|
-
else this.storage.removeItem(REFRESH_KEY);
|
|
1334
|
-
}
|
|
1335
|
-
clearToken() {
|
|
1336
|
-
this.storage.removeItem(ACCESS_KEY);
|
|
1337
|
-
this.storage.removeItem(REFRESH_KEY);
|
|
1338
|
-
}
|
|
1339
|
-
isAuthenticated() {
|
|
1340
|
-
return this.getToken() !== null;
|
|
1341
|
-
}
|
|
1342
|
-
// ── Locale / API key ────────────────────────────────────────────────────
|
|
1343
|
-
getLocale() {
|
|
1344
|
-
return this.locale ?? detectLocale();
|
|
1345
|
-
}
|
|
1346
|
-
setLocale(locale) {
|
|
1347
|
-
this.locale = locale;
|
|
1348
|
-
}
|
|
1349
|
-
getApiKey() {
|
|
1350
|
-
return this.apiKey;
|
|
1351
|
-
}
|
|
1352
|
-
setApiKey(key) {
|
|
1353
|
-
this.apiKey = key;
|
|
1354
|
-
}
|
|
1355
|
-
};
|
|
1003
|
+
__name(createSseClient, "createSseClient");
|
|
1356
1004
|
|
|
1357
|
-
// src/_api/generated/
|
|
1358
|
-
var
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1005
|
+
// src/_api/generated/core/pathSerializer.gen.ts
|
|
1006
|
+
var separatorArrayExplode = /* @__PURE__ */ __name((style) => {
|
|
1007
|
+
switch (style) {
|
|
1008
|
+
case "label":
|
|
1009
|
+
return ".";
|
|
1010
|
+
case "matrix":
|
|
1011
|
+
return ";";
|
|
1012
|
+
case "simple":
|
|
1013
|
+
return ",";
|
|
1014
|
+
default:
|
|
1015
|
+
return "&";
|
|
1366
1016
|
}
|
|
1367
|
-
|
|
1368
|
-
|
|
1017
|
+
}, "separatorArrayExplode");
|
|
1018
|
+
var separatorArrayNoExplode = /* @__PURE__ */ __name((style) => {
|
|
1019
|
+
switch (style) {
|
|
1020
|
+
case "form":
|
|
1021
|
+
return ",";
|
|
1022
|
+
case "pipeDelimited":
|
|
1023
|
+
return "|";
|
|
1024
|
+
case "spaceDelimited":
|
|
1025
|
+
return "%20";
|
|
1026
|
+
default:
|
|
1027
|
+
return ",";
|
|
1369
1028
|
}
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1029
|
+
}, "separatorArrayNoExplode");
|
|
1030
|
+
var separatorObjectExplode = /* @__PURE__ */ __name((style) => {
|
|
1031
|
+
switch (style) {
|
|
1032
|
+
case "label":
|
|
1033
|
+
return ".";
|
|
1034
|
+
case "matrix":
|
|
1035
|
+
return ";";
|
|
1036
|
+
case "simple":
|
|
1037
|
+
return ",";
|
|
1038
|
+
default:
|
|
1039
|
+
return "&";
|
|
1375
1040
|
}
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1041
|
+
}, "separatorObjectExplode");
|
|
1042
|
+
var serializeArrayParam = /* @__PURE__ */ __name(({
|
|
1043
|
+
allowReserved,
|
|
1044
|
+
explode,
|
|
1045
|
+
name,
|
|
1046
|
+
style,
|
|
1047
|
+
value
|
|
1048
|
+
}) => {
|
|
1049
|
+
if (!explode) {
|
|
1050
|
+
const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
1051
|
+
switch (style) {
|
|
1052
|
+
case "label":
|
|
1053
|
+
return `.${joinedValues2}`;
|
|
1054
|
+
case "matrix":
|
|
1055
|
+
return `;${name}=${joinedValues2}`;
|
|
1056
|
+
case "simple":
|
|
1057
|
+
return joinedValues2;
|
|
1058
|
+
default:
|
|
1059
|
+
return `${name}=${joinedValues2}`;
|
|
1382
1060
|
}
|
|
1383
|
-
return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
|
|
1384
1061
|
}
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
if (
|
|
1388
|
-
|
|
1389
|
-
return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
|
|
1390
|
-
}
|
|
1391
|
-
if (details.error) return String(details.error);
|
|
1392
|
-
if (details.message) return String(details.message);
|
|
1393
|
-
const fieldErrors = this.fieldErrors;
|
|
1394
|
-
if (fieldErrors) {
|
|
1395
|
-
const firstField = Object.keys(fieldErrors)[0];
|
|
1396
|
-
if (firstField) return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
|
|
1062
|
+
const separator = separatorArrayExplode(style);
|
|
1063
|
+
const joinedValues = value.map((v) => {
|
|
1064
|
+
if (style === "label" || style === "simple") {
|
|
1065
|
+
return allowReserved ? v : encodeURIComponent(v);
|
|
1397
1066
|
}
|
|
1398
|
-
return
|
|
1067
|
+
return serializePrimitiveParam({
|
|
1068
|
+
allowReserved,
|
|
1069
|
+
name,
|
|
1070
|
+
value: v
|
|
1071
|
+
});
|
|
1072
|
+
}).join(separator);
|
|
1073
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
1074
|
+
}, "serializeArrayParam");
|
|
1075
|
+
var serializePrimitiveParam = /* @__PURE__ */ __name(({
|
|
1076
|
+
allowReserved,
|
|
1077
|
+
name,
|
|
1078
|
+
value
|
|
1079
|
+
}) => {
|
|
1080
|
+
if (value === void 0 || value === null) {
|
|
1081
|
+
return "";
|
|
1399
1082
|
}
|
|
1400
|
-
|
|
1401
|
-
|
|
1083
|
+
if (typeof value === "object") {
|
|
1084
|
+
throw new Error(
|
|
1085
|
+
"Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
|
|
1086
|
+
);
|
|
1402
1087
|
}
|
|
1403
|
-
|
|
1404
|
-
|
|
1088
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
1089
|
+
}, "serializePrimitiveParam");
|
|
1090
|
+
var serializeObjectParam = /* @__PURE__ */ __name(({
|
|
1091
|
+
allowReserved,
|
|
1092
|
+
explode,
|
|
1093
|
+
name,
|
|
1094
|
+
style,
|
|
1095
|
+
value,
|
|
1096
|
+
valueOnly
|
|
1097
|
+
}) => {
|
|
1098
|
+
if (value instanceof Date) {
|
|
1099
|
+
return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
1100
|
+
}
|
|
1101
|
+
if (style !== "deepObject" && !explode) {
|
|
1102
|
+
let values = [];
|
|
1103
|
+
Object.entries(value).forEach(([key, v]) => {
|
|
1104
|
+
values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
|
|
1105
|
+
});
|
|
1106
|
+
const joinedValues2 = values.join(",");
|
|
1107
|
+
switch (style) {
|
|
1108
|
+
case "form":
|
|
1109
|
+
return `${name}=${joinedValues2}`;
|
|
1110
|
+
case "label":
|
|
1111
|
+
return `.${joinedValues2}`;
|
|
1112
|
+
case "matrix":
|
|
1113
|
+
return `;${name}=${joinedValues2}`;
|
|
1114
|
+
default:
|
|
1115
|
+
return joinedValues2;
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
const separator = separatorObjectExplode(style);
|
|
1119
|
+
const joinedValues = Object.entries(value).map(
|
|
1120
|
+
([key, v]) => serializePrimitiveParam({
|
|
1121
|
+
allowReserved,
|
|
1122
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
1123
|
+
value: v
|
|
1124
|
+
})
|
|
1125
|
+
).join(separator);
|
|
1126
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
1127
|
+
}, "serializeObjectParam");
|
|
1128
|
+
|
|
1129
|
+
// src/_api/generated/core/utils.gen.ts
|
|
1130
|
+
var PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
1131
|
+
var defaultPathSerializer = /* @__PURE__ */ __name(({ path, url: _url }) => {
|
|
1132
|
+
let url = _url;
|
|
1133
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
1134
|
+
if (matches) {
|
|
1135
|
+
for (const match of matches) {
|
|
1136
|
+
let explode = false;
|
|
1137
|
+
let name = match.substring(1, match.length - 1);
|
|
1138
|
+
let style = "simple";
|
|
1139
|
+
if (name.endsWith("*")) {
|
|
1140
|
+
explode = true;
|
|
1141
|
+
name = name.substring(0, name.length - 1);
|
|
1142
|
+
}
|
|
1143
|
+
if (name.startsWith(".")) {
|
|
1144
|
+
name = name.substring(1);
|
|
1145
|
+
style = "label";
|
|
1146
|
+
} else if (name.startsWith(";")) {
|
|
1147
|
+
name = name.substring(1);
|
|
1148
|
+
style = "matrix";
|
|
1149
|
+
}
|
|
1150
|
+
const value = path[name];
|
|
1151
|
+
if (value === void 0 || value === null) {
|
|
1152
|
+
continue;
|
|
1153
|
+
}
|
|
1154
|
+
if (Array.isArray(value)) {
|
|
1155
|
+
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
1156
|
+
continue;
|
|
1157
|
+
}
|
|
1158
|
+
if (typeof value === "object") {
|
|
1159
|
+
url = url.replace(
|
|
1160
|
+
match,
|
|
1161
|
+
serializeObjectParam({
|
|
1162
|
+
explode,
|
|
1163
|
+
name,
|
|
1164
|
+
style,
|
|
1165
|
+
value,
|
|
1166
|
+
valueOnly: true
|
|
1167
|
+
})
|
|
1168
|
+
);
|
|
1169
|
+
continue;
|
|
1170
|
+
}
|
|
1171
|
+
if (style === "matrix") {
|
|
1172
|
+
url = url.replace(
|
|
1173
|
+
match,
|
|
1174
|
+
`;${serializePrimitiveParam({
|
|
1175
|
+
name,
|
|
1176
|
+
value
|
|
1177
|
+
})}`
|
|
1178
|
+
);
|
|
1179
|
+
continue;
|
|
1180
|
+
}
|
|
1181
|
+
const replaceValue = encodeURIComponent(
|
|
1182
|
+
style === "label" ? `.${value}` : value
|
|
1183
|
+
);
|
|
1184
|
+
url = url.replace(match, replaceValue);
|
|
1185
|
+
}
|
|
1405
1186
|
}
|
|
1406
|
-
|
|
1407
|
-
|
|
1187
|
+
return url;
|
|
1188
|
+
}, "defaultPathSerializer");
|
|
1189
|
+
var getUrl = /* @__PURE__ */ __name(({
|
|
1190
|
+
baseUrl,
|
|
1191
|
+
path,
|
|
1192
|
+
query,
|
|
1193
|
+
querySerializer,
|
|
1194
|
+
url: _url
|
|
1195
|
+
}) => {
|
|
1196
|
+
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
1197
|
+
let url = (baseUrl ?? "") + pathUrl;
|
|
1198
|
+
if (path) {
|
|
1199
|
+
url = defaultPathSerializer({ path, url });
|
|
1408
1200
|
}
|
|
1409
|
-
|
|
1410
|
-
|
|
1201
|
+
let search = query ? querySerializer(query) : "";
|
|
1202
|
+
if (search.startsWith("?")) {
|
|
1203
|
+
search = search.substring(1);
|
|
1411
1204
|
}
|
|
1412
|
-
|
|
1413
|
-
|
|
1205
|
+
if (search) {
|
|
1206
|
+
url += `?${search}`;
|
|
1414
1207
|
}
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
if (m) return decodeURIComponent(m[1]);
|
|
1425
|
-
}
|
|
1426
|
-
if (typeof navigator !== "undefined" && navigator.language) {
|
|
1427
|
-
return navigator.language;
|
|
1208
|
+
return url;
|
|
1209
|
+
}, "getUrl");
|
|
1210
|
+
function getValidRequestBody(options) {
|
|
1211
|
+
const hasBody = options.body !== void 0;
|
|
1212
|
+
const isSerializedBody = hasBody && options.bodySerializer;
|
|
1213
|
+
if (isSerializedBody) {
|
|
1214
|
+
if ("serializedBody" in options) {
|
|
1215
|
+
const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
|
|
1216
|
+
return hasSerializedBody ? options.serializedBody : null;
|
|
1428
1217
|
}
|
|
1429
|
-
|
|
1218
|
+
return options.body !== "" ? options.body : null;
|
|
1430
1219
|
}
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
__name(detectLocale2, "detectLocale");
|
|
1434
|
-
var API2 = class {
|
|
1435
|
-
static {
|
|
1436
|
-
__name(this, "API");
|
|
1220
|
+
if (hasBody) {
|
|
1221
|
+
return options.body;
|
|
1437
1222
|
}
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
this.locale = opts.locale ?? null;
|
|
1448
|
-
this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
|
|
1449
|
-
const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
|
|
1450
|
-
client.setConfig({ baseUrl: this.baseUrl, credentials });
|
|
1451
|
-
client.interceptors.request.use((request) => {
|
|
1452
|
-
const access = this.getToken();
|
|
1453
|
-
if (access) request.headers.set("Authorization", `Bearer ${access}`);
|
|
1454
|
-
const locale = this.locale ?? detectLocale2();
|
|
1455
|
-
if (locale) request.headers.set("Accept-Language", locale);
|
|
1456
|
-
if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
|
|
1457
|
-
return request;
|
|
1458
|
-
});
|
|
1223
|
+
return void 0;
|
|
1224
|
+
}
|
|
1225
|
+
__name(getValidRequestBody, "getValidRequestBody");
|
|
1226
|
+
|
|
1227
|
+
// src/_api/generated/core/auth.gen.ts
|
|
1228
|
+
var getAuthToken = /* @__PURE__ */ __name(async (auth2, callback) => {
|
|
1229
|
+
const token = typeof callback === "function" ? await callback(auth2) : callback;
|
|
1230
|
+
if (!token) {
|
|
1231
|
+
return;
|
|
1459
1232
|
}
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
return this.baseUrl;
|
|
1233
|
+
if (auth2.scheme === "bearer") {
|
|
1234
|
+
return `Bearer ${token}`;
|
|
1463
1235
|
}
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
client.setConfig({ baseUrl: this.baseUrl });
|
|
1236
|
+
if (auth2.scheme === "basic") {
|
|
1237
|
+
return `Basic ${btoa(token)}`;
|
|
1467
1238
|
}
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1239
|
+
return token;
|
|
1240
|
+
}, "getAuthToken");
|
|
1241
|
+
|
|
1242
|
+
// src/_api/generated/client/utils.gen.ts
|
|
1243
|
+
var createQuerySerializer = /* @__PURE__ */ __name(({
|
|
1244
|
+
parameters = {},
|
|
1245
|
+
...args
|
|
1246
|
+
} = {}) => {
|
|
1247
|
+
const querySerializer = /* @__PURE__ */ __name((queryParams) => {
|
|
1248
|
+
const search = [];
|
|
1249
|
+
if (queryParams && typeof queryParams === "object") {
|
|
1250
|
+
for (const name in queryParams) {
|
|
1251
|
+
const value = queryParams[name];
|
|
1252
|
+
if (value === void 0 || value === null) {
|
|
1253
|
+
continue;
|
|
1254
|
+
}
|
|
1255
|
+
const options = parameters[name] || args;
|
|
1256
|
+
if (Array.isArray(value)) {
|
|
1257
|
+
const serializedArray = serializeArrayParam({
|
|
1258
|
+
allowReserved: options.allowReserved,
|
|
1259
|
+
explode: true,
|
|
1260
|
+
name,
|
|
1261
|
+
style: "form",
|
|
1262
|
+
value,
|
|
1263
|
+
...options.array
|
|
1264
|
+
});
|
|
1265
|
+
if (serializedArray) search.push(serializedArray);
|
|
1266
|
+
} else if (typeof value === "object") {
|
|
1267
|
+
const serializedObject = serializeObjectParam({
|
|
1268
|
+
allowReserved: options.allowReserved,
|
|
1269
|
+
explode: true,
|
|
1270
|
+
name,
|
|
1271
|
+
style: "deepObject",
|
|
1272
|
+
value,
|
|
1273
|
+
...options.object
|
|
1274
|
+
});
|
|
1275
|
+
if (serializedObject) search.push(serializedObject);
|
|
1276
|
+
} else {
|
|
1277
|
+
const serializedPrimitive = serializePrimitiveParam({
|
|
1278
|
+
allowReserved: options.allowReserved,
|
|
1279
|
+
name,
|
|
1280
|
+
value
|
|
1281
|
+
});
|
|
1282
|
+
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
return search.join("&");
|
|
1287
|
+
}, "querySerializer");
|
|
1288
|
+
return querySerializer;
|
|
1289
|
+
}, "createQuerySerializer");
|
|
1290
|
+
var getParseAs = /* @__PURE__ */ __name((contentType) => {
|
|
1291
|
+
if (!contentType) {
|
|
1292
|
+
return "stream";
|
|
1471
1293
|
}
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1294
|
+
const cleanContent = contentType.split(";")[0]?.trim();
|
|
1295
|
+
if (!cleanContent) {
|
|
1296
|
+
return;
|
|
1475
1297
|
}
|
|
1476
|
-
|
|
1477
|
-
return
|
|
1298
|
+
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
|
|
1299
|
+
return "json";
|
|
1478
1300
|
}
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
else this.storage.removeItem(REFRESH_KEY2);
|
|
1301
|
+
if (cleanContent === "multipart/form-data") {
|
|
1302
|
+
return "formData";
|
|
1482
1303
|
}
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
this.storage.removeItem(REFRESH_KEY2);
|
|
1304
|
+
if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
|
|
1305
|
+
return "blob";
|
|
1486
1306
|
}
|
|
1487
|
-
|
|
1488
|
-
return
|
|
1307
|
+
if (cleanContent.startsWith("text/")) {
|
|
1308
|
+
return "text";
|
|
1489
1309
|
}
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1310
|
+
return;
|
|
1311
|
+
}, "getParseAs");
|
|
1312
|
+
var checkForExistence = /* @__PURE__ */ __name((options, name) => {
|
|
1313
|
+
if (!name) {
|
|
1314
|
+
return false;
|
|
1493
1315
|
}
|
|
1494
|
-
|
|
1495
|
-
|
|
1316
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
|
|
1317
|
+
return true;
|
|
1496
1318
|
}
|
|
1497
|
-
|
|
1498
|
-
|
|
1319
|
+
return false;
|
|
1320
|
+
}, "checkForExistence");
|
|
1321
|
+
var setAuthParams = /* @__PURE__ */ __name(async ({
|
|
1322
|
+
security,
|
|
1323
|
+
...options
|
|
1324
|
+
}) => {
|
|
1325
|
+
for (const auth2 of security) {
|
|
1326
|
+
if (checkForExistence(options, auth2.name)) {
|
|
1327
|
+
continue;
|
|
1328
|
+
}
|
|
1329
|
+
const token = await getAuthToken(auth2, options.auth);
|
|
1330
|
+
if (!token) {
|
|
1331
|
+
continue;
|
|
1332
|
+
}
|
|
1333
|
+
const name = auth2.name ?? "Authorization";
|
|
1334
|
+
switch (auth2.in) {
|
|
1335
|
+
case "query":
|
|
1336
|
+
if (!options.query) {
|
|
1337
|
+
options.query = {};
|
|
1338
|
+
}
|
|
1339
|
+
options.query[name] = token;
|
|
1340
|
+
break;
|
|
1341
|
+
case "cookie":
|
|
1342
|
+
options.headers.append("Cookie", `${name}=${token}`);
|
|
1343
|
+
break;
|
|
1344
|
+
case "header":
|
|
1345
|
+
default:
|
|
1346
|
+
options.headers.set(name, token);
|
|
1347
|
+
break;
|
|
1348
|
+
}
|
|
1499
1349
|
}
|
|
1500
|
-
|
|
1501
|
-
|
|
1350
|
+
}, "setAuthParams");
|
|
1351
|
+
var buildUrl = /* @__PURE__ */ __name((options) => getUrl({
|
|
1352
|
+
baseUrl: options.baseUrl,
|
|
1353
|
+
path: options.path,
|
|
1354
|
+
query: options.query,
|
|
1355
|
+
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
1356
|
+
url: options.url
|
|
1357
|
+
}), "buildUrl");
|
|
1358
|
+
var mergeConfigs = /* @__PURE__ */ __name((a, b) => {
|
|
1359
|
+
const config = { ...a, ...b };
|
|
1360
|
+
if (config.baseUrl?.endsWith("/")) {
|
|
1361
|
+
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
1502
1362
|
}
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
var
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1363
|
+
config.headers = mergeHeaders(a.headers, b.headers);
|
|
1364
|
+
return config;
|
|
1365
|
+
}, "mergeConfigs");
|
|
1366
|
+
var headersEntries = /* @__PURE__ */ __name((headers) => {
|
|
1367
|
+
const entries = [];
|
|
1368
|
+
headers.forEach((value, key) => {
|
|
1369
|
+
entries.push([key, value]);
|
|
1370
|
+
});
|
|
1371
|
+
return entries;
|
|
1372
|
+
}, "headersEntries");
|
|
1373
|
+
var mergeHeaders = /* @__PURE__ */ __name((...headers) => {
|
|
1374
|
+
const mergedHeaders = new Headers();
|
|
1375
|
+
for (const header of headers) {
|
|
1376
|
+
if (!header) {
|
|
1377
|
+
continue;
|
|
1513
1378
|
}
|
|
1514
|
-
|
|
1515
|
-
|
|
1379
|
+
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
1380
|
+
for (const [key, value] of iterator) {
|
|
1381
|
+
if (value === null) {
|
|
1382
|
+
mergedHeaders.delete(key);
|
|
1383
|
+
} else if (Array.isArray(value)) {
|
|
1384
|
+
for (const v of value) {
|
|
1385
|
+
mergedHeaders.append(key, v);
|
|
1386
|
+
}
|
|
1387
|
+
} else if (value !== void 0) {
|
|
1388
|
+
mergedHeaders.set(
|
|
1389
|
+
key,
|
|
1390
|
+
typeof value === "object" ? JSON.stringify(value) : value
|
|
1391
|
+
);
|
|
1392
|
+
}
|
|
1516
1393
|
}
|
|
1517
|
-
} catch {
|
|
1518
1394
|
}
|
|
1519
|
-
return
|
|
1520
|
-
}
|
|
1521
|
-
|
|
1522
|
-
var API3 = class {
|
|
1395
|
+
return mergedHeaders;
|
|
1396
|
+
}, "mergeHeaders");
|
|
1397
|
+
var Interceptors = class {
|
|
1523
1398
|
static {
|
|
1524
|
-
__name(this, "
|
|
1525
|
-
}
|
|
1526
|
-
baseUrl;
|
|
1527
|
-
storage;
|
|
1528
|
-
locale;
|
|
1529
|
-
apiKey;
|
|
1530
|
-
logger;
|
|
1531
|
-
constructor(baseUrl2, opts = {}) {
|
|
1532
|
-
this.baseUrl = baseUrl2.replace(/\/$/, "");
|
|
1533
|
-
this.storage = opts.storage ?? new LocalStorageAdapter();
|
|
1534
|
-
this.logger = new APILogger(opts.logger);
|
|
1535
|
-
this.locale = opts.locale ?? null;
|
|
1536
|
-
this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
|
|
1537
|
-
const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
|
|
1538
|
-
client.setConfig({ baseUrl: this.baseUrl, credentials });
|
|
1539
|
-
client.interceptors.request.use((request) => {
|
|
1540
|
-
const access = this.getToken();
|
|
1541
|
-
if (access) request.headers.set("Authorization", `Bearer ${access}`);
|
|
1542
|
-
const locale = this.locale ?? detectLocale3();
|
|
1543
|
-
if (locale) request.headers.set("Accept-Language", locale);
|
|
1544
|
-
if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
|
|
1545
|
-
return request;
|
|
1546
|
-
});
|
|
1547
|
-
}
|
|
1548
|
-
// ── Base URL ────────────────────────────────────────────────────────────
|
|
1549
|
-
getBaseUrl() {
|
|
1550
|
-
return this.baseUrl;
|
|
1551
|
-
}
|
|
1552
|
-
setBaseUrl(url) {
|
|
1553
|
-
this.baseUrl = url.replace(/\/$/, "");
|
|
1554
|
-
client.setConfig({ baseUrl: this.baseUrl });
|
|
1555
|
-
}
|
|
1556
|
-
// ── Tokens ──────────────────────────────────────────────────────────────
|
|
1557
|
-
getToken() {
|
|
1558
|
-
return this.storage.getItem(ACCESS_KEY3);
|
|
1559
|
-
}
|
|
1560
|
-
setToken(token) {
|
|
1561
|
-
if (token) this.storage.setItem(ACCESS_KEY3, token);
|
|
1562
|
-
else this.storage.removeItem(ACCESS_KEY3);
|
|
1563
|
-
}
|
|
1564
|
-
getRefreshToken() {
|
|
1565
|
-
return this.storage.getItem(REFRESH_KEY3);
|
|
1399
|
+
__name(this, "Interceptors");
|
|
1566
1400
|
}
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1401
|
+
fns = [];
|
|
1402
|
+
clear() {
|
|
1403
|
+
this.fns = [];
|
|
1570
1404
|
}
|
|
1571
|
-
|
|
1572
|
-
this.
|
|
1573
|
-
this.
|
|
1405
|
+
eject(id) {
|
|
1406
|
+
const index = this.getInterceptorIndex(id);
|
|
1407
|
+
if (this.fns[index]) {
|
|
1408
|
+
this.fns[index] = null;
|
|
1409
|
+
}
|
|
1574
1410
|
}
|
|
1575
|
-
|
|
1576
|
-
|
|
1411
|
+
exists(id) {
|
|
1412
|
+
const index = this.getInterceptorIndex(id);
|
|
1413
|
+
return Boolean(this.fns[index]);
|
|
1577
1414
|
}
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1415
|
+
getInterceptorIndex(id) {
|
|
1416
|
+
if (typeof id === "number") {
|
|
1417
|
+
return this.fns[id] ? id : -1;
|
|
1418
|
+
}
|
|
1419
|
+
return this.fns.indexOf(id);
|
|
1581
1420
|
}
|
|
1582
|
-
|
|
1583
|
-
|
|
1421
|
+
update(id, fn) {
|
|
1422
|
+
const index = this.getInterceptorIndex(id);
|
|
1423
|
+
if (this.fns[index]) {
|
|
1424
|
+
this.fns[index] = fn;
|
|
1425
|
+
return id;
|
|
1426
|
+
}
|
|
1427
|
+
return false;
|
|
1584
1428
|
}
|
|
1585
|
-
|
|
1586
|
-
|
|
1429
|
+
use(fn) {
|
|
1430
|
+
this.fns.push(fn);
|
|
1431
|
+
return this.fns.length - 1;
|
|
1587
1432
|
}
|
|
1588
|
-
|
|
1589
|
-
|
|
1433
|
+
};
|
|
1434
|
+
var createInterceptors = /* @__PURE__ */ __name(() => ({
|
|
1435
|
+
error: new Interceptors(),
|
|
1436
|
+
request: new Interceptors(),
|
|
1437
|
+
response: new Interceptors()
|
|
1438
|
+
}), "createInterceptors");
|
|
1439
|
+
var defaultQuerySerializer = createQuerySerializer({
|
|
1440
|
+
allowReserved: false,
|
|
1441
|
+
array: {
|
|
1442
|
+
explode: true,
|
|
1443
|
+
style: "form"
|
|
1444
|
+
},
|
|
1445
|
+
object: {
|
|
1446
|
+
explode: true,
|
|
1447
|
+
style: "deepObject"
|
|
1590
1448
|
}
|
|
1449
|
+
});
|
|
1450
|
+
var defaultHeaders = {
|
|
1451
|
+
"Content-Type": "application/json"
|
|
1591
1452
|
};
|
|
1453
|
+
var createConfig = /* @__PURE__ */ __name((override = {}) => ({
|
|
1454
|
+
...jsonBodySerializer,
|
|
1455
|
+
headers: defaultHeaders,
|
|
1456
|
+
parseAs: "auto",
|
|
1457
|
+
querySerializer: defaultQuerySerializer,
|
|
1458
|
+
...override
|
|
1459
|
+
}), "createConfig");
|
|
1592
1460
|
|
|
1593
|
-
// src/_api/generated/
|
|
1594
|
-
var
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1461
|
+
// src/_api/generated/client/client.gen.ts
|
|
1462
|
+
var createClient = /* @__PURE__ */ __name((config = {}) => {
|
|
1463
|
+
let _config = mergeConfigs(createConfig(), config);
|
|
1464
|
+
const getConfig = /* @__PURE__ */ __name(() => ({ ..._config }), "getConfig");
|
|
1465
|
+
const setConfig = /* @__PURE__ */ __name((config2) => {
|
|
1466
|
+
_config = mergeConfigs(_config, config2);
|
|
1467
|
+
return getConfig();
|
|
1468
|
+
}, "setConfig");
|
|
1469
|
+
const interceptors = createInterceptors();
|
|
1470
|
+
const beforeRequest = /* @__PURE__ */ __name(async (options) => {
|
|
1471
|
+
const opts = {
|
|
1472
|
+
..._config,
|
|
1473
|
+
...options,
|
|
1474
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
1475
|
+
headers: mergeHeaders(_config.headers, options.headers),
|
|
1476
|
+
serializedBody: void 0
|
|
1477
|
+
};
|
|
1478
|
+
if (opts.security) {
|
|
1479
|
+
await setAuthParams({
|
|
1480
|
+
...opts,
|
|
1481
|
+
security: opts.security
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
if (opts.requestValidator) {
|
|
1485
|
+
await opts.requestValidator(opts);
|
|
1486
|
+
}
|
|
1487
|
+
if (opts.body !== void 0 && opts.bodySerializer) {
|
|
1488
|
+
opts.serializedBody = opts.bodySerializer(opts.body);
|
|
1489
|
+
}
|
|
1490
|
+
if (opts.body === void 0 || opts.serializedBody === "") {
|
|
1491
|
+
opts.headers.delete("Content-Type");
|
|
1492
|
+
}
|
|
1493
|
+
const resolvedOpts = opts;
|
|
1494
|
+
const url = buildUrl(resolvedOpts);
|
|
1495
|
+
return { opts: resolvedOpts, url };
|
|
1496
|
+
}, "beforeRequest");
|
|
1497
|
+
const request = /* @__PURE__ */ __name(async (options) => {
|
|
1498
|
+
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
1499
|
+
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
1500
|
+
let request2;
|
|
1501
|
+
let response;
|
|
1502
|
+
try {
|
|
1503
|
+
const { opts, url } = await beforeRequest(options);
|
|
1504
|
+
const requestInit = {
|
|
1505
|
+
redirect: "follow",
|
|
1506
|
+
...opts,
|
|
1507
|
+
body: getValidRequestBody(opts)
|
|
1508
|
+
};
|
|
1509
|
+
request2 = new Request(url, requestInit);
|
|
1510
|
+
for (const fn of interceptors.request.fns) {
|
|
1511
|
+
if (fn) {
|
|
1512
|
+
request2 = await fn(request2, opts);
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
const _fetch = opts.fetch;
|
|
1516
|
+
response = await _fetch(request2);
|
|
1517
|
+
for (const fn of interceptors.response.fns) {
|
|
1518
|
+
if (fn) {
|
|
1519
|
+
response = await fn(response, request2, opts);
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
const result = {
|
|
1523
|
+
request: request2,
|
|
1524
|
+
response
|
|
1525
|
+
};
|
|
1526
|
+
if (response.ok) {
|
|
1527
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
1528
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
1529
|
+
let emptyData;
|
|
1530
|
+
switch (parseAs) {
|
|
1531
|
+
case "arrayBuffer":
|
|
1532
|
+
case "blob":
|
|
1533
|
+
case "text":
|
|
1534
|
+
emptyData = await response[parseAs]();
|
|
1535
|
+
break;
|
|
1536
|
+
case "formData":
|
|
1537
|
+
emptyData = new FormData();
|
|
1538
|
+
break;
|
|
1539
|
+
case "stream":
|
|
1540
|
+
emptyData = response.body;
|
|
1541
|
+
break;
|
|
1542
|
+
case "json":
|
|
1543
|
+
default:
|
|
1544
|
+
emptyData = {};
|
|
1545
|
+
break;
|
|
1546
|
+
}
|
|
1547
|
+
return opts.responseStyle === "data" ? emptyData : {
|
|
1548
|
+
data: emptyData,
|
|
1549
|
+
...result
|
|
1550
|
+
};
|
|
1551
|
+
}
|
|
1552
|
+
let data;
|
|
1553
|
+
switch (parseAs) {
|
|
1554
|
+
case "arrayBuffer":
|
|
1555
|
+
case "blob":
|
|
1556
|
+
case "formData":
|
|
1557
|
+
case "text":
|
|
1558
|
+
data = await response[parseAs]();
|
|
1559
|
+
break;
|
|
1560
|
+
case "json": {
|
|
1561
|
+
const text = await response.text();
|
|
1562
|
+
data = text ? JSON.parse(text) : {};
|
|
1563
|
+
break;
|
|
1564
|
+
}
|
|
1565
|
+
case "stream":
|
|
1566
|
+
return opts.responseStyle === "data" ? response.body : {
|
|
1567
|
+
data: response.body,
|
|
1568
|
+
...result
|
|
1569
|
+
};
|
|
1570
|
+
}
|
|
1571
|
+
if (parseAs === "json") {
|
|
1572
|
+
if (opts.responseValidator) {
|
|
1573
|
+
await opts.responseValidator(data);
|
|
1574
|
+
}
|
|
1575
|
+
if (opts.responseTransformer) {
|
|
1576
|
+
data = await opts.responseTransformer(data);
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
return opts.responseStyle === "data" ? data : {
|
|
1580
|
+
data,
|
|
1581
|
+
...result
|
|
1582
|
+
};
|
|
1583
|
+
}
|
|
1584
|
+
const textError = await response.text();
|
|
1585
|
+
let jsonError;
|
|
1586
|
+
try {
|
|
1587
|
+
jsonError = JSON.parse(textError);
|
|
1588
|
+
} catch {
|
|
1589
|
+
}
|
|
1590
|
+
throw jsonError ?? textError;
|
|
1591
|
+
} catch (error) {
|
|
1592
|
+
let finalError = error;
|
|
1593
|
+
for (const fn of interceptors.error.fns) {
|
|
1594
|
+
if (fn) {
|
|
1595
|
+
finalError = await fn(finalError, response, request2, options);
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
finalError = finalError || {};
|
|
1599
|
+
if (throwOnError) {
|
|
1600
|
+
throw finalError;
|
|
1601
|
+
}
|
|
1602
|
+
return responseStyle === "data" ? void 0 : {
|
|
1603
|
+
error: finalError,
|
|
1604
|
+
request: request2,
|
|
1605
|
+
response
|
|
1606
|
+
};
|
|
1607
|
+
}
|
|
1608
|
+
}, "request");
|
|
1609
|
+
const makeMethodFn = /* @__PURE__ */ __name((method) => (options) => request({ ...options, method }), "makeMethodFn");
|
|
1610
|
+
const makeSseFn = /* @__PURE__ */ __name((method) => async (options) => {
|
|
1611
|
+
const { opts, url } = await beforeRequest(options);
|
|
1612
|
+
return createSseClient({
|
|
1613
|
+
...opts,
|
|
1614
|
+
body: opts.body,
|
|
1615
|
+
method,
|
|
1616
|
+
onRequest: /* @__PURE__ */ __name(async (url2, init) => {
|
|
1617
|
+
let request2 = new Request(url2, init);
|
|
1618
|
+
for (const fn of interceptors.request.fns) {
|
|
1619
|
+
if (fn) {
|
|
1620
|
+
request2 = await fn(request2, opts);
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
return request2;
|
|
1624
|
+
}, "onRequest"),
|
|
1625
|
+
serializedBody: getValidRequestBody(opts),
|
|
1626
|
+
url
|
|
1627
|
+
});
|
|
1628
|
+
}, "makeSseFn");
|
|
1629
|
+
const _buildUrl = /* @__PURE__ */ __name((options) => buildUrl({ ..._config, ...options }), "_buildUrl");
|
|
1630
|
+
return {
|
|
1631
|
+
buildUrl: _buildUrl,
|
|
1632
|
+
connect: makeMethodFn("CONNECT"),
|
|
1633
|
+
delete: makeMethodFn("DELETE"),
|
|
1634
|
+
get: makeMethodFn("GET"),
|
|
1635
|
+
getConfig,
|
|
1636
|
+
head: makeMethodFn("HEAD"),
|
|
1637
|
+
interceptors,
|
|
1638
|
+
options: makeMethodFn("OPTIONS"),
|
|
1639
|
+
patch: makeMethodFn("PATCH"),
|
|
1640
|
+
post: makeMethodFn("POST"),
|
|
1641
|
+
put: makeMethodFn("PUT"),
|
|
1642
|
+
request,
|
|
1643
|
+
setConfig,
|
|
1644
|
+
sse: {
|
|
1645
|
+
connect: makeSseFn("CONNECT"),
|
|
1646
|
+
delete: makeSseFn("DELETE"),
|
|
1647
|
+
get: makeSseFn("GET"),
|
|
1648
|
+
head: makeSseFn("HEAD"),
|
|
1649
|
+
options: makeSseFn("OPTIONS"),
|
|
1650
|
+
patch: makeSseFn("PATCH"),
|
|
1651
|
+
post: makeSseFn("POST"),
|
|
1652
|
+
put: makeSseFn("PUT"),
|
|
1653
|
+
trace: makeSseFn("TRACE")
|
|
1654
|
+
},
|
|
1655
|
+
trace: makeMethodFn("TRACE")
|
|
1656
|
+
};
|
|
1657
|
+
}, "createClient");
|
|
1658
|
+
|
|
1659
|
+
// src/_api/generated/client.gen.ts
|
|
1660
|
+
var client = createClient(createConfig({ baseUrl: "http://localhost:8000" }));
|
|
1661
|
+
installAuthOnClient(client);
|
|
1599
1662
|
|
|
1600
1663
|
// src/_api/generated/sdk.gen.ts
|
|
1601
1664
|
var Cfg = class {
|