refactor(core): migrate to Bun and converge acquisition policies and Agent boundaries
This commit is contained in:
1 parent
3f1c6d02f6
commit
27c0f27434
268 files changed
+7468
-7852
No files matched your search
@@ -123,7 +123,9 @@ export function trimTmdb(body: unknown): unknown {
|
||||
}
|
||||
|
||||
/** 离线回放:按键取录制的响应;没录到的请求直接报错(说明召回逻辑变了,需要重新录制) */
|
||||
export function fixtureFetch(fixtures: Record<string, unknown>): typeof fetch {
|
||||
export function fixtureFetch(
|
||||
fixtures: Record<string, unknown>,
|
||||
): (input: RequestInfo | URL, init?: RequestInit) => Promise<Response> {
|
||||
return (async (input: string | URL | Request) => {
|
||||
const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
||||
const key = fixtureKey(url);
|
||||
@@ -134,10 +136,13 @@ export function fixtureFetch(fixtures: Record<string, unknown>): typeof fetch {
|
||||
status,
|
||||
headers: { "content-type": "application/json" },
|
||||
});
|
||||
}) as typeof fetch;
|
||||
}) as (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
||||
}
|
||||
|
||||
export function tmdbFor(fetchImpl: typeof fetch, baseUrl = "http://tmdb.fixture/3"): TmdbClient {
|
||||
export function tmdbFor(
|
||||
fetchImpl: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>,
|
||||
baseUrl = "http://tmdb.fixture/3",
|
||||
): TmdbClient {
|
||||
return new TmdbClient({ apiKey: "x", baseUrl, fetch: fetchImpl, retries: 0 });
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user