// Type declarations for @aitizer/js (https://api.aitizer.com/sdk/aitizer.js) export interface AitizerClientOptions { headers?: Record; appSession?: string | null; flatten?: boolean; fetch?: typeof fetch; /** Silence the warning about using a REST token inside a browser. */ dangerouslyAllowBrowser?: boolean; } export interface AitizerResult { data: T | null; error: AitizerError | null; count: number | null; status: number; } export type Row = { id: number; created_at: string; updated_at: string } & Record; export interface RawRecord { id: number; fields: Record; created_at: string; updated_at: string } export interface TableInfo { id: number; name: string; icon: string; created_at: string; updated_at: string } export interface ColumnInfo { id: number; name: string; type: string; required: boolean; position: number; options?: Array<{ id: string; label: string; color?: string }>; formula?: string } export class AitizerError extends Error { status: number; code?: string; details?: unknown; } export type FilterOp = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'like' | 'ilike' | 'is' | 'in' | 'cs'; export class QueryBuilder implements PromiseLike> { select(columns?: string, options?: { count?: 'exact' }): this; insert(values: Record | Record[]): this; upsert(values: Record | Record[]): this; update(values: Record): this; delete(): this; eq(field: string, value: any): this; neq(field: string, value: any): this; gt(field: string, value: any): this; gte(field: string, value: any): this; lt(field: string, value: any): this; lte(field: string, value: any): this; like(field: string, pattern: string): this; ilike(field: string, pattern: string): this; is(field: string, value: null | boolean): this; in(field: string, values: any[]): this; contains(field: string, values: any | any[]): this; not(field: string, op: FilterOp, value: any): this; filter(field: string, op: string, value: any): this; search(field: string, term: string): this; order(field: string, options?: { ascending?: boolean }): this; limit(n: number): this; range(from: number, to: number): this; single(): QueryBuilder & PromiseLike>; maybeSingle(): QueryBuilder & PromiseLike>; then, R2 = never>( onfulfilled?: ((value: AitizerResult) => R1 | PromiseLike) | null, onrejected?: ((reason: any) => R2 | PromiseLike) | null, ): PromiseLike; } export interface AppAuth { signInWithPassword(credentials: { email: string; password: string }): Promise<{ data: any; error: AitizerError | null }>; signUp(credentials: { email: string; password: string; [k: string]: any }): Promise<{ data: any; error: AitizerError | null }>; getUser(): Promise<{ data: any; error: AitizerError | null }>; signOut(): { error: null }; } export class AitizerClient { constructor(url: string, token?: string | null, options?: AitizerClientOptions); from(table: string | number): QueryBuilder; sql(query: string): Promise>; tables(): Promise>; columns(table: string | number): Promise>; compute(table: string | number, recordId: number, columnName: string): Promise>; setSession(session: string | null): void; clearCache(): void; auth: AppAuth; } export function createClient(url: string, token?: string | null, options?: AitizerClientOptions): AitizerClient; export default createClient;