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:
parent
e491949749
commit
a62ac2e075
6 changed files with 0 additions and 78 deletions
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"name": "@multica/fetch",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./*": "./src/*.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "catalog:"
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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),
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
export { setConfig, getConsoleUrl, getGatewayUrl } from "./config"
|
||||
export { consoleApi, HttpError } from "./http-client"
|
||||
|
|
@ -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
6
pnpm-lock.yaml
generated
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue