chore: remove @multica/fetch package

No consumers remain after migrating to pure WebSocket RPC.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Naiyuan Qing 2026-02-02 16:29:27 +08:00
parent e491949749
commit a62ac2e075
6 changed files with 0 additions and 78 deletions

View file

@ -1,13 +0,0 @@
{
"name": "@multica/fetch",
"version": "0.1.0",
"private": true,
"type": "module",
"exports": {
".": "./src/index.ts",
"./*": "./src/*.ts"
},
"devDependencies": {
"typescript": "catalog:"
}
}

View file

@ -1,15 +0,0 @@
let consoleUrl = "http://localhost:4000"
let gatewayUrl = "http://localhost:3000"
export function setConfig(config: { consoleUrl?: string; gatewayUrl?: string }) {
if (config.consoleUrl) consoleUrl = config.consoleUrl
if (config.gatewayUrl) gatewayUrl = config.gatewayUrl
}
export function getConsoleUrl(): string {
return consoleUrl
}
export function getGatewayUrl(): string {
return gatewayUrl
}

View file

@ -1,28 +0,0 @@
import { getConsoleUrl } from "./config"
export class HttpError extends Error {
constructor(
public status: number,
public statusText: string,
) {
super(`HTTP ${status}: ${statusText}`)
}
}
async function request<T>(method: string, path: string, body?: unknown): Promise<T> {
const res = await fetch(`${getConsoleUrl()}${path}`, {
method,
headers: body ? { "Content-Type": "application/json" } : undefined,
body: body ? JSON.stringify(body) : undefined,
})
if (!res.ok) throw new HttpError(res.status, res.statusText)
return res.json()
}
/** Console REST API */
export const consoleApi = {
get: <T>(path: string) => request<T>("GET", path),
post: <T>(path: string, body?: unknown) => request<T>("POST", path, body),
put: <T>(path: string, body: unknown) => request<T>("PUT", path, body),
delete: <T>(path: string) => request<T>("DELETE", path),
}

View file

@ -1,2 +0,0 @@
export { setConfig, getConsoleUrl, getGatewayUrl } from "./config"
export { consoleApi, HttpError } from "./http-client"

View file

@ -1,14 +0,0 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"declaration": true,
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src"]
}

6
pnpm-lock.yaml generated
View file

@ -258,12 +258,6 @@ importers:
specifier: 'catalog:'
version: 5.9.3
packages/fetch:
devDependencies:
typescript:
specifier: 'catalog:'
version: 5.9.3
packages/sdk:
dependencies:
socket.io-client: