Skip to content
This repository was archived by the owner on May 13, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 2 additions & 31 deletions src/server/static-react/src/api/clients/viewsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -23,7 +17,7 @@ export interface TransformView {

export type ViewWithState = [TransformView, string];

export interface ViewListResponse {
interface ViewListResponse {
views: ViewWithState[];
count: number;
}
Expand All @@ -36,29 +30,6 @@ export async function listViews(): Promise<ViewWithState[]> {
return resp.data?.views ?? [];
}

export async function getView(name: string): Promise<TransformView> {
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<string, string>;
}

export async function createView(req: CreateViewRequest): Promise<void> {
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<void> {
const resp = await client().post<{ approved: boolean }>(`/view/${encodeURIComponent(name)}/approve`, {});
if (!resp.success) throw new Error(resp.error || `Failed to approve view: ${name}`);
Expand Down
Loading