import { B2Client } from "./client"; export interface SchemaListEntry { id?: string; handle: string; name: string; icon?: string; show_nav_item?: boolean; module_schema_id?: string; table_name?: string; created_at?: string; updated_at?: string; } export declare enum DataType { "string" = "string", "number" = "number", "boolean" = "boolean", "array" = "array", "object" = "object" } export declare enum FormatterType { "date" = "date", "currency" = "currency" } export interface SchemaEntryProp { key: string; type: DataType; label: string; item?: SchemaArrayItemProp; grid_size?: GridSize; grid_clear_left?: boolean; helper_text?: string; editor_type?: EditorType; height?: string; editing?: boolean; formatter_type?: FormatterType; formatter_currency_prefix?: string; display_in_list?: boolean; searchable?: boolean; string_match_message?: string; string_max_length?: number; dropdown_options?: DropdownOption[]; } export declare enum EditorType { "textbox" = "textbox", "dropdown" = "dropdown", "file" = "file", "checkbox" = "checkbox", "code" = "code", "none" = "none" } export declare type DropdownOption = { label: string; value: string; }; export declare enum GridSize { "size_1" = "1", "size_2" = "2", "size_3" = "3", "size_4" = "4", "size_5" = "5", "size_6" = "6", "size_7" = "7", "size_8" = "8", "size_9" = "9", "size_10" = "10", "size_11" = "11", "size_12" = "12", "size_default" = "default" } export interface SchemaArrayItemProp { dropdown_options?: DropdownOption[]; editor_type?: EditorType; grid_clear_left?: boolean; grid_size?: GridSize; type: DataType; } export interface SchemaEntry extends SchemaListEntry { base_url?: string; skip_archive?: boolean; order?: number; props: SchemaEntryProp[]; } export interface SchemaObjectQuery { sort_key?: string; sort_direction?: string; term?: string; limit?: number; skip?: number; } export interface SchemaObjectEntry { id?: string; handle: string; created_at?: string; updated_at?: string; } export interface SchemaObjectQueryResult { count: number; items: SchemaObjectEntry[]; } export interface SchemaObjectWalkResult { save: boolean; done?: boolean; } export declare class SchemaWrapper { private s; private handle; private schema; constructor(schema: B2Schema, handle: string); private proxy; getSchema(): Promise; createSchema(schema: SchemaEntry): Promise; updateSchema(schema: SchemaEntry): Promise; deleteSchema(): Promise; query(query?: SchemaObjectQuery): Promise; getObject(id: string): Promise; getObjects(ids: string[]): Promise; getObjectByHandle(handle: string): Promise; createObject(obj: SchemaObjectEntry): Promise; updateObject(obj: SchemaObjectEntry): Promise; deleteObject(id: string): Promise; walkObjects(fn: WalkFunction, listObjectOnly?: boolean): Promise; walkAndUpdateObjects(fn: WalkUpdateFunction): Promise; } export declare type WalkFunction = (obj: SchemaObjectEntry, index: number, total: number) => Promise; export declare type WalkUpdateFunction = (obj: SchemaObjectEntry, index: number, total: number) => Promise; export declare class B2Schema { readonly isRef: boolean; private c; private path; constructor(client: B2Client, entryPath: string, isRef?: boolean); handle(handle: string): SchemaWrapper; listAllSchema(): Promise; getSchema(id: string): Promise; createSchema(schema: SchemaEntry): Promise; updateSchema(schema: SchemaEntry): Promise; deleteSchema(schemaId: string): Promise; query(schemaId: string, query?: SchemaObjectQuery): Promise; getObject(schemaId: string, id: string): Promise; getObjects(schemaId: string, ids: string[]): Promise; getObjectByHandle(schemaId: string, handle: string): Promise; createObject(schemaId: string, obj: SchemaObjectEntry): Promise; updateObject(schemaId: string, obj: SchemaObjectEntry): Promise; deleteObject(schemaId: string, id: string): Promise; walkObjects(schemaId: string, fn: WalkFunction, listObjectOnly?: boolean): Promise; walkAndUpdateObjects(schemaId: string, fn: WalkUpdateFunction): Promise; }