chore(deps): update enka.ts to v2

This commit is contained in:
2026-05-19 12:49:43 +07:00 Unverified
parent ac5dc289a8
commit 1305e6c4f9
3 changed files with 46 additions and 41 deletions
+11 -12
View File
@@ -4,7 +4,7 @@ import { file, hash, inspect } from "bun";
import { status, t } from "elysia";
import {
EquipType,
fetchEnka,
enka,
InternalError,
InvalidFormatError,
MaintenanceError,
@@ -14,10 +14,10 @@ import {
} from "enka.ts";
import { ImageResponse } from "takumi-js/response";
import { font, iconFont, sansFont } from "@/assets/fonts";
import { generateBackground } from "@/games/genshin/assets/background";
import { ConstsSvg } from "@/games/genshin/assets/consts";
import { featherImage } from "@/games/genshin/assets/feather";
import { font, iconFont, sansFont } from "@/assets/fonts";
import { EnkaIcon } from "@/games/genshin/assets/icons";
import type { library } from "@/games/genshin/assets/icons-library";
import ListDiffExample from "@/games/genshin/assets/listoriginal.webp" with { type: "file" };
@@ -34,13 +34,16 @@ import { buildDisplayRows } from "@/games/genshin/data/rows";
import type { RollSummary } from "@/games/genshin/data/substat";
import { buildRollSummary } from "@/games/genshin/data/substat";
import { Locale, SubstatOrder } from "@/games/genshin/types/enka";
import { FightPropMapEnum, PercentageFightProp } from "@/games/genshin/types/fightPropMap";
import {
FightPropMapEnum,
PercentageFightProp,
} from "@/games/genshin/types/fightPropMap";
import type { App } from "@/index";
import { Deduplicator } from "@/lib/dedupe";
import { createLogger } from "@/lib/logger";
import { ErrorPage } from "@/v1/error";
import DiffPage from "../../../hmr.html";
import { ErrorPage } from "@/v1/error";
import { ListPage } from "./render/list";
const cache = new TTLCache();
@@ -94,7 +97,7 @@ export function card(app: App) {
).finally(() => log`Stores loaded`),
),
deduper.acquire(`enka-${uid}`, () =>
fetchEnka(uid, false).finally(() => log`Enka data loaded`),
enka.genshin(uid).finally(() => log`Enka data loaded`),
),
]);
@@ -137,9 +140,7 @@ export function card(app: App) {
),
feature("API") || uid !== "775956514"
? deduper.acquire(`enka-${uid}`, () =>
fetchEnka(uid, false).finally(
() => log`Enka data loaded`,
),
enka.genshin(uid).finally(() => log`Enka data loaded`),
)
: mockData,
]);
@@ -254,9 +255,7 @@ export function card(app: App) {
),
feature("API") || uid !== "775956514"
? deduper.acquire(`enka-${uid}`, () =>
fetchEnka(uid, false).finally(
() => log`Enka data loaded`,
),
enka.genshin(uid).finally(() => log`Enka data loaded`),
)
: mockData,
]);
@@ -1016,7 +1015,7 @@ export function card(app: App) {
"/health/enka",
async () => {
try {
fetchEnka("888888888");
await enka.genshin("888888888");
return "OK";
} catch (err) {
if (err instanceof InvalidFormatError)