import { AttributeType, IndexType, VarType } from './enums'; import { CompiledKuneiform } from './payload'; /** * @typedef {Object} DeployBody is the interface for deploying a database with the `kwil.deploy()` method. * * @property {CompiledKuneiform} schema - The compiled Kuneiform schema to deploy. * @property {string?} description (optional) - The description of the database. * @property {number} nonce (optional) - The nonce of the transaction. */ export interface DeployBody { schema: CompiledKuneiform; description?: string; nonce?: number; } /** * @typedef {Object} DropBody is the interface for dropping a database with the `kwil.drop()` method. * * @property {string} dbid - The database ID of the database to drop. * @property {string?} description (optional) - The description of the database. * @property {number} nonce (optional) - The nonce of the transaction. */ export interface DropBody { dbid: string; description?: string; nonce?: number; } export interface DataInfo { name: VarType; is_array: boolean; metadata?: Array | Array | null; } type DataInfoFactory = (p: number, s: number) => DataInfo; export declare namespace DataType { const Uuid: DataInfo; const UuidArray: DataInfo; const Text: DataInfo; const TextArray: DataInfo; const Int: DataInfo; const IntArray: DataInfo; const Boolean: DataInfo; const BooleanArray: DataInfo; const Numeric: DataInfoFactory; const NumericArray: DataInfoFactory; const Null: DataInfo; const NullArray: DataInfo; const Bytea: DataInfo; const ByteaArray: DataInfo; } /** DEPRECATED */ export interface Database { owner: Uint8Array; name: string; extensions: ReadonlyArray; tables: ReadonlyArray; actions: ReadonlyArray; procedures: ReadonlyArray; foreign_calls: ReadonlyArray; } export interface Table { name: string; columns: ReadonlyArray; indexes: ReadonlyArray; foreign_keys: ReadonlyArray; } export interface Column { name: string; type: DataInfo; attributes: ReadonlyArray; } export interface Attribute { type: AttributeType; value: string; } export interface Index { name: string; columns: ReadonlyArray; type: IndexType; } export interface ForeignKey { child_keys: ReadonlyArray; parent_keys: ReadonlyArray; parent_table: string; actions: ReadonlyArray; } export interface ForeignKeyAction { on: string; do: string; } export interface ActionSchema { name: string; annotations: ReadonlyArray; parameters: ReadonlyArray; public: boolean; modifiers: ReadonlyArray; body: string; } export interface Extension { name: string; initialization: ReadonlyArray; alias: string; } export interface ExtensionConfig { name: string; value: string; } export interface Procedure { name: string; parameters: ReadonlyArray; public: boolean; modifiers: ReadonlyArray; body: string; return_types: ProcedureReturn; annotations: ReadonlyArray; } export interface NamedType { name: string; type: DataInfo; } export interface ProcedureReturn { is_table: boolean; fields: ReadonlyArray; } export interface ForeignProcedure { name: string; parameters: ReadonlyArray; return_types: ProcedureReturn; } export {};