feat(proj): init

This commit is contained in:
vl.arkhangelskii
2026-09-21 03:53:15 +03:00
commit 3e34f391b3
258 changed files with 20968 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
export type TilesetBounds = {
minLon: number;
minLat: number;
maxLon: number;
maxLat: number;
};
export type SourceItem = {
id: string;
name: string;
enabled: boolean;
center: number[];
status: string;
downloadedAt?: string | null;
builtAt?: string | null;
lastError?: string | null;
bounds?: TilesetBounds | null;
};
export type StyleItem = {
name: string;
url: string;
};
export type SyncStatus = {
isRunning: boolean;
lastStartedAt?: string | null;
lastFinishedAt?: string | null;
nextScheduledAt?: string | null;
lastError?: string | null;
};
export async function fetchJson<T>(url: string, options?: RequestInit): Promise<T> {
const response = await fetch(url, options);
if (!response.ok) {
const body = await response.text();
throw new Error(body || `${response.status} ${response.statusText}`);
}
if (response.status === 204) {
return undefined as T;
}
return (await response.json()) as T;
}