From 14b3e63236c2cbf3847713f6df4420b00d7054cc Mon Sep 17 00:00:00 2001 From: Tom Tang <4220945+shiba4life@users.noreply.github.com> Date: Tue, 12 May 2026 19:14:15 +0800 Subject: [PATCH] refactor(api/views): drop 3 dead exports + unexport 2 internal types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit viewsClient.ts exported ViewState, getView, createView, and CreateViewRequest with zero references anywhere else in the codebase; TransformView and ViewListResponse were exported but only used file-locally (TransformView indirectly through ViewWithState). Removed the dead symbols and dropped the export keyword on the two file-local types. ViewWithState and the four active CRUD functions (listViews, approveView, blockView, deleteView) are untouched, and ViewsTab.tsx — the only external consumer — is unchanged. Same pattern as #1014/#1015/#1017/#1018. --- .../src/api/clients/viewsClient.ts | 33 ++----------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/src/server/static-react/src/api/clients/viewsClient.ts b/src/server/static-react/src/api/clients/viewsClient.ts index 4bac5f34..e3b39e6d 100644 --- a/src/server/static-react/src/api/clients/viewsClient.ts +++ b/src/server/static-react/src/api/clients/viewsClient.ts @@ -2,13 +2,7 @@ import { getSharedClient } from '../core/client'; -export interface ViewState { - Available: undefined; - Approved: undefined; - Blocked: undefined; -} - -export interface TransformView { +interface TransformView { name: string; schema_type: string; key_config?: { hash_field?: string; range_field?: string } | null; @@ -23,7 +17,7 @@ export interface TransformView { export type ViewWithState = [TransformView, string]; -export interface ViewListResponse { +interface ViewListResponse { views: ViewWithState[]; count: number; } @@ -36,29 +30,6 @@ export async function listViews(): Promise { return resp.data?.views ?? []; } -export async function getView(name: string): Promise { - const resp = await client().get<{ view: TransformView }>(`/view/${encodeURIComponent(name)}`); - if (!resp.success) throw new Error(resp.error || `Failed to get view: ${name}`); - return resp.data!.view; -} - -export interface CreateViewRequest { - name: string; - schema_type: string; - key_config?: { hash_field?: string; range_field?: string } | null; - input_queries: Array<{ - schema_name: string; - fields: string[]; - }>; - wasm_transform?: string | null; // base64 - output_fields: Record; -} - -export async function createView(req: CreateViewRequest): Promise { - const resp = await client().post<{ success: boolean }>('/view', req); - if (!resp.success) throw new Error(resp.error || 'Failed to create view'); -} - export async function approveView(name: string): Promise { const resp = await client().post<{ approved: boolean }>(`/view/${encodeURIComponent(name)}/approve`, {}); if (!resp.success) throw new Error(resp.error || `Failed to approve view: ${name}`);