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