import type { InstallCommand, PackageManagerRunner, PackageManagerType } from '@capgo/find-package-manager';
import type { SemVer } from '@std/semver';
import type { SupabaseClient } from '@supabase/supabase-js';
import type { Buffer } from 'node:buffer';
import type { CapacitorConfig, ExtConfigPairs } from './config';
import type { Compatibility, CompatibilityDetails, NativePackage } from './schemas/common';
import type { Database } from './types/supabase.types';
import { spinner as spinnerC } from '@clack/prompts';
export declare const baseKey = ".capgo_key";
export declare const baseKeyV2 = ".capgo_key_v2";
export declare const baseKeyPub = ".capgo_key.pub";
export declare const baseKeyPubV2 = ".capgo_key_v2.pub";
export declare const defaultHost = "https://capgo.app";
export declare const defaultFileHost = "https://files.capgo.app";
export declare const defaultApiHost = "https://api.capgo.app";
export declare const defaultHostWeb = "https://console.capgo.app";
export declare const UPLOAD_TIMEOUT = 120000;
export declare const ALERT_UPLOAD_SIZE_BYTES: number;
export declare const MAX_UPLOAD_LENGTH_BYTES: number;
export declare const MAX_CHUNK_SIZE_BYTES: number;
export declare const PACKNAME = "package.json";
export type ArrayElement<ArrayType extends readonly unknown[]> = ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
export type Organization = ArrayElement<Database['public']['Functions']['get_orgs_v7']['Returns']>;
export declare const regexSemver: RegExp;
/**
 * Format an error for display. If it's a security policy error,
 * returns a human-readable message with actionable steps.
 */
export declare function formatError(error: any): string;
export declare function check2FAAccessForOrg(supabase: SupabaseClient<Database>, orgId: string, silent?: boolean): Promise<void>;
type TagKey = Lowercase<string>;
/** Tag Type */
type Tags = Record<TagKey, string | number | boolean>;
type Parser = 'markdown' | 'text';
/**
 * Options for publishing LogSnag events
 */
interface TrackOptions {
    /**
     * Channel name
     * example: "waitlist"
     */
    channel: string;
    /**
     * Event name
     * example: "User Joined"
     */
    event: string;
    /**
     * Event description
     * example: "joe@example.com joined waitlist"
     */
    description?: string;
    /**
     * User ID
     * example: "user-123"
     */
    user_id?: string;
    /**
     * Event icon (emoji)
     * must be a single emoji
     * example: "🎉"
     */
    icon?: string;
    /**
     * Event tags
     * example: { username: "mattie" }
     */
    tags?: Tags;
    /**
     * Send push notification
     */
    notify?: boolean;
    /**
     * Parser for description
     */
    parser?: Parser;
    /**
     * Event timestamp
     */
    timestamp?: number | Date;
}
export type { OptionsBase } from './schemas/base';
export declare function wait(ms: number): Promise<unknown>;
interface PromptInteractivityOptions {
    silent?: boolean;
    stdinIsTTY?: boolean;
    stdoutIsTTY?: boolean;
    ci?: boolean;
}
export declare function canPromptInteractively({ silent, stdinIsTTY, stdoutIsTTY, ci, }?: PromptInteractivityOptions): boolean;
export declare function projectIsMonorepo(dir: string): boolean;
export declare function findRoot(dir: string): string;
export declare function getPackageScripts(f?: string, file?: string | undefined): Record<string, string>;
export declare function getBundleVersion(f?: string, file?: string | undefined): string;
/**
 * Get the actual installed version of a package from node_modules (not from package.json)
 * Uses multiple resolution strategies to find the installed version:
 * 1. require.resolve - Works with all package managers
 * 2. Walk up node_modules - Handles hoisted dependencies in monorepos
 * 3. Native config files (iOS/Android) - For @capgo/capacitor-updater only
 * 4. Fallback to declared version in package.json
 *
 * @param packageName - The package name to check
 * @param rootDir - The root directory of the project
 * @param packageJsonPath - Optional custom package.json path provided by user (takes priority if provided)
 */
export declare function getInstalledVersion(packageName: string, rootDir?: string, packageJsonPath?: string): Promise<string | null>;
export declare function getAllPackagesDependencies(f?: string, file?: string | undefined): Promise<Map<string, string>>;
export declare function getConfig(): Promise<{
    config: {
        [x: string]: unknown;
        appId: string;
        appName: string;
        webDir: string;
        plugins?: Record<string, any> | undefined;
        android?: Record<string, any> | undefined;
    };
    path: string;
}>;
export declare function updateConfigbyKey(key: string, newConfig: any): Promise<ExtConfigPairs>;
export declare function updateConfigUpdater(newConfig: any): Promise<ExtConfigPairs>;
export declare function getLocalConfig(): Promise<CapgoConfig>;
interface CapgoConfig {
    supaHost?: string;
    supaKey?: string;
    host: string;
    hostWeb: string;
    hostFilesApi: string;
    hostApi: string;
}
export declare function getRemoteConfig(): Promise<CapgoConfig>;
interface CapgoFilesConfig {
    partialUpload: boolean;
    partialUploadForced: boolean;
    TUSUpload: boolean;
    TUSUploadForced: boolean;
    maxUploadLength: number;
    maxChunkSize: number;
    alertUploadSize: number;
}
export declare function getRemoteFileConfig(): Promise<CapgoFilesConfig>;
export declare function createSupabaseClient(apikey: string, supaHost?: string, supaKey?: string): Promise<SupabaseClient<Database, "public", "public", {
    Tables: {
        apikeys: {
            Row: {
                created_at: string | null;
                expires_at: string | null;
                id: number;
                key: string | null;
                key_hash: string | null;
                limited_to_apps: string[] | null;
                limited_to_orgs: string[] | null;
                mode: Database["public"]["Enums"]["key_mode"];
                name: string;
                updated_at: string | null;
                user_id: string;
            };
            Insert: {
                created_at?: string | null;
                expires_at?: string | null;
                id?: number;
                key?: string | null;
                key_hash?: string | null;
                limited_to_apps?: string[] | null;
                limited_to_orgs?: string[] | null;
                mode: Database["public"]["Enums"]["key_mode"];
                name: string;
                updated_at?: string | null;
                user_id: string;
            };
            Update: {
                created_at?: string | null;
                expires_at?: string | null;
                id?: number;
                key?: string | null;
                key_hash?: string | null;
                limited_to_apps?: string[] | null;
                limited_to_orgs?: string[] | null;
                mode?: Database["public"]["Enums"]["key_mode"];
                name?: string;
                updated_at?: string | null;
                user_id?: string;
            };
            Relationships: [{
                foreignKeyName: "apikeys_user_id_fkey";
                columns: ["user_id"];
                isOneToOne: false;
                referencedRelation: "users";
                referencedColumns: ["id"];
            }];
        };
        app_metrics_cache: {
            Row: {
                cached_at: string;
                end_date: string;
                id: number;
                org_id: string;
                response: import("./types/supabase.types").Json;
                start_date: string;
            };
            Insert: {
                cached_at?: string;
                end_date: string;
                id?: number;
                org_id: string;
                response: import("./types/supabase.types").Json;
                start_date: string;
            };
            Update: {
                cached_at?: string;
                end_date?: string;
                id?: number;
                org_id?: string;
                response?: import("./types/supabase.types").Json;
                start_date?: string;
            };
            Relationships: [{
                foreignKeyName: "app_metrics_cache_org_id_fkey";
                columns: ["org_id"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }];
        };
        app_versions: {
            Row: {
                app_id: string;
                checksum: string | null;
                cli_version: string | null;
                comment: string | null;
                created_at: string | null;
                deleted: boolean;
                external_url: string | null;
                id: number;
                key_id: string | null;
                link: string | null;
                manifest: Database["public"]["CompositeTypes"]["manifest_entry"][] | null;
                manifest_count: number;
                min_update_version: string | null;
                name: string;
                native_packages: import("./types/supabase.types").Json[] | null;
                owner_org: string;
                r2_path: string | null;
                session_key: string | null;
                storage_provider: string;
                updated_at: string | null;
                user_id: string | null;
            };
            Insert: {
                app_id: string;
                checksum?: string | null;
                cli_version?: string | null;
                comment?: string | null;
                created_at?: string | null;
                deleted?: boolean;
                external_url?: string | null;
                id?: number;
                key_id?: string | null;
                link?: string | null;
                manifest?: Database["public"]["CompositeTypes"]["manifest_entry"][] | null;
                manifest_count?: number;
                min_update_version?: string | null;
                name: string;
                native_packages?: import("./types/supabase.types").Json[] | null;
                owner_org: string;
                r2_path?: string | null;
                session_key?: string | null;
                storage_provider?: string;
                updated_at?: string | null;
                user_id?: string | null;
            };
            Update: {
                app_id?: string;
                checksum?: string | null;
                cli_version?: string | null;
                comment?: string | null;
                created_at?: string | null;
                deleted?: boolean;
                external_url?: string | null;
                id?: number;
                key_id?: string | null;
                link?: string | null;
                manifest?: Database["public"]["CompositeTypes"]["manifest_entry"][] | null;
                manifest_count?: number;
                min_update_version?: string | null;
                name?: string;
                native_packages?: import("./types/supabase.types").Json[] | null;
                owner_org?: string;
                r2_path?: string | null;
                session_key?: string | null;
                storage_provider?: string;
                updated_at?: string | null;
                user_id?: string | null;
            };
            Relationships: [{
                foreignKeyName: "app_versions_app_id_fkey";
                columns: ["app_id"];
                isOneToOne: false;
                referencedRelation: "apps";
                referencedColumns: ["app_id"];
            }, {
                foreignKeyName: "owner_org_id_fkey";
                columns: ["owner_org"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }];
        };
        app_versions_meta: {
            Row: {
                app_id: string;
                checksum: string;
                created_at: string | null;
                id: number;
                owner_org: string;
                size: number;
                updated_at: string | null;
            };
            Insert: {
                app_id: string;
                checksum: string;
                created_at?: string | null;
                id?: number;
                owner_org: string;
                size: number;
                updated_at?: string | null;
            };
            Update: {
                app_id?: string;
                checksum?: string;
                created_at?: string | null;
                id?: number;
                owner_org?: string;
                size?: number;
                updated_at?: string | null;
            };
            Relationships: [{
                foreignKeyName: "app_versions_meta_app_id_fkey";
                columns: ["app_id"];
                isOneToOne: false;
                referencedRelation: "apps";
                referencedColumns: ["app_id"];
            }, {
                foreignKeyName: "app_versions_meta_id_fkey";
                columns: ["id"];
                isOneToOne: true;
                referencedRelation: "app_versions";
                referencedColumns: ["id"];
            }, {
                foreignKeyName: "owner_org_id_fkey";
                columns: ["owner_org"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }];
        };
        apps: {
            Row: {
                android_store_url: string | null;
                app_id: string;
                channel_device_count: number;
                created_at: string | null;
                default_upload_channel: string;
                existing_app: boolean;
                expose_metadata: boolean;
                icon_url: string;
                id: string | null;
                ios_store_url: string | null;
                last_version: string | null;
                manifest_bundle_count: number;
                need_onboarding: boolean;
                name: string | null;
                owner_org: string;
                retention: number;
                transfer_history: import("./types/supabase.types").Json[] | null;
                updated_at: string | null;
                user_id: string | null;
            };
            Insert: {
                android_store_url?: string | null;
                app_id: string;
                channel_device_count?: number;
                created_at?: string | null;
                default_upload_channel?: string;
                existing_app?: boolean;
                expose_metadata?: boolean;
                icon_url: string;
                id?: string | null;
                ios_store_url?: string | null;
                last_version?: string | null;
                manifest_bundle_count?: number;
                need_onboarding?: boolean;
                name?: string | null;
                owner_org: string;
                retention?: number;
                transfer_history?: import("./types/supabase.types").Json[] | null;
                updated_at?: string | null;
                user_id?: string | null;
            };
            Update: {
                android_store_url?: string | null;
                app_id?: string;
                channel_device_count?: number;
                created_at?: string | null;
                default_upload_channel?: string;
                existing_app?: boolean;
                expose_metadata?: boolean;
                icon_url?: string;
                id?: string | null;
                ios_store_url?: string | null;
                last_version?: string | null;
                manifest_bundle_count?: number;
                need_onboarding?: boolean;
                name?: string | null;
                owner_org?: string;
                retention?: number;
                transfer_history?: import("./types/supabase.types").Json[] | null;
                updated_at?: string | null;
                user_id?: string | null;
            };
            Relationships: [{
                foreignKeyName: "apps_user_id_fkey";
                columns: ["user_id"];
                isOneToOne: false;
                referencedRelation: "users";
                referencedColumns: ["id"];
            }, {
                foreignKeyName: "owner_org_id_fkey";
                columns: ["owner_org"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }];
        };
        audit_logs: {
            Row: {
                changed_fields: string[] | null;
                created_at: string;
                id: number;
                new_record: import("./types/supabase.types").Json | null;
                old_record: import("./types/supabase.types").Json | null;
                operation: string;
                org_id: string;
                record_id: string;
                table_name: string;
                user_id: string | null;
            };
            Insert: {
                changed_fields?: string[] | null;
                created_at?: string;
                id?: number;
                new_record?: import("./types/supabase.types").Json | null;
                old_record?: import("./types/supabase.types").Json | null;
                operation: string;
                org_id: string;
                record_id: string;
                table_name: string;
                user_id?: string | null;
            };
            Update: {
                changed_fields?: string[] | null;
                created_at?: string;
                id?: number;
                new_record?: import("./types/supabase.types").Json | null;
                old_record?: import("./types/supabase.types").Json | null;
                operation?: string;
                org_id?: string;
                record_id?: string;
                table_name?: string;
                user_id?: string | null;
            };
            Relationships: [{
                foreignKeyName: "audit_logs_org_id_fkey";
                columns: ["org_id"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }, {
                foreignKeyName: "audit_logs_user_id_fkey";
                columns: ["user_id"];
                isOneToOne: false;
                referencedRelation: "users";
                referencedColumns: ["id"];
            }];
        };
        bandwidth_usage: {
            Row: {
                app_id: string;
                device_id: string;
                file_size: number;
                id: number;
                timestamp: string;
            };
            Insert: {
                app_id: string;
                device_id: string;
                file_size: number;
                id?: number;
                timestamp?: string;
            };
            Update: {
                app_id?: string;
                device_id?: string;
                file_size?: number;
                id?: number;
                timestamp?: string;
            };
            Relationships: [];
        };
        build_logs: {
            Row: {
                billable_seconds: number;
                build_id: string;
                build_time_unit: number;
                created_at: string;
                id: string;
                org_id: string;
                platform: string;
                user_id: string | null;
            };
            Insert: {
                billable_seconds: number;
                build_id: string;
                build_time_unit: number;
                created_at?: string;
                id?: string;
                org_id: string;
                platform: string;
                user_id?: string | null;
            };
            Update: {
                billable_seconds?: number;
                build_id?: string;
                build_time_unit?: number;
                created_at?: string;
                id?: string;
                org_id?: string;
                platform?: string;
                user_id?: string | null;
            };
            Relationships: [{
                foreignKeyName: "build_logs_org_id_fkey";
                columns: ["org_id"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }];
        };
        build_requests: {
            Row: {
                app_id: string;
                build_config: import("./types/supabase.types").Json | null;
                build_mode: string;
                builder_job_id: string | null;
                created_at: string;
                id: string;
                last_error: string | null;
                owner_org: string;
                platform: string;
                requested_by: string;
                status: string;
                updated_at: string;
                upload_expires_at: string;
                upload_path: string;
                upload_session_key: string;
                upload_url: string;
            };
            Insert: {
                app_id: string;
                build_config?: import("./types/supabase.types").Json | null;
                build_mode?: string;
                builder_job_id?: string | null;
                created_at?: string;
                id?: string;
                last_error?: string | null;
                owner_org: string;
                platform: string;
                requested_by: string;
                status?: string;
                updated_at?: string;
                upload_expires_at: string;
                upload_path: string;
                upload_session_key: string;
                upload_url: string;
            };
            Update: {
                app_id?: string;
                build_config?: import("./types/supabase.types").Json | null;
                build_mode?: string;
                builder_job_id?: string | null;
                created_at?: string;
                id?: string;
                last_error?: string | null;
                owner_org?: string;
                platform?: string;
                requested_by?: string;
                status?: string;
                updated_at?: string;
                upload_expires_at?: string;
                upload_path?: string;
                upload_session_key?: string;
                upload_url?: string;
            };
            Relationships: [{
                foreignKeyName: "build_requests_app_id_fkey";
                columns: ["app_id"];
                isOneToOne: false;
                referencedRelation: "apps";
                referencedColumns: ["app_id"];
            }, {
                foreignKeyName: "build_requests_owner_org_fkey";
                columns: ["owner_org"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }];
        };
        capgo_credits_steps: {
            Row: {
                created_at: string;
                id: number;
                org_id: string | null;
                price_per_unit: number;
                step_max: number;
                step_min: number;
                type: string;
                unit_factor: number;
                updated_at: string;
            };
            Insert: {
                created_at?: string;
                id?: number;
                org_id?: string | null;
                price_per_unit: number;
                step_max: number;
                step_min: number;
                type: string;
                unit_factor?: number;
                updated_at?: string;
            };
            Update: {
                created_at?: string;
                id?: number;
                org_id?: string | null;
                price_per_unit?: number;
                step_max?: number;
                step_min?: number;
                type?: string;
                unit_factor?: number;
                updated_at?: string;
            };
            Relationships: [{
                foreignKeyName: "capgo_credits_steps_org_id_fkey";
                columns: ["org_id"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }];
        };
        channel_devices: {
            Row: {
                app_id: string;
                channel_id: number;
                created_at: string | null;
                device_id: string;
                id: number;
                owner_org: string;
                updated_at: string;
            };
            Insert: {
                app_id: string;
                channel_id: number;
                created_at?: string | null;
                device_id: string;
                id?: number;
                owner_org: string;
                updated_at?: string;
            };
            Update: {
                app_id?: string;
                channel_id?: number;
                created_at?: string | null;
                device_id?: string;
                id?: number;
                owner_org?: string;
                updated_at?: string;
            };
            Relationships: [{
                foreignKeyName: "channel_devices_app_id_fkey";
                columns: ["app_id"];
                isOneToOne: false;
                referencedRelation: "apps";
                referencedColumns: ["app_id"];
            }, {
                foreignKeyName: "channel_devices_channel_id_fkey";
                columns: ["channel_id"];
                isOneToOne: false;
                referencedRelation: "channels";
                referencedColumns: ["id"];
            }, {
                foreignKeyName: "owner_org_id_fkey";
                columns: ["owner_org"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }];
        };
        channels: {
            Row: {
                allow_dev: boolean;
                allow_device: boolean;
                allow_device_self_set: boolean;
                allow_emulator: boolean;
                allow_prod: boolean;
                android: boolean;
                app_id: string;
                created_at: string;
                created_by: string;
                disable_auto_update: Database["public"]["Enums"]["disable_update"];
                disable_auto_update_under_native: boolean;
                id: number;
                ios: boolean;
                name: string;
                owner_org: string;
                public: boolean;
                updated_at: string;
                version: number;
            };
            Insert: {
                allow_dev?: boolean;
                allow_device?: boolean;
                allow_device_self_set?: boolean;
                allow_emulator?: boolean;
                allow_prod?: boolean;
                android?: boolean;
                app_id: string;
                created_at?: string;
                created_by: string;
                disable_auto_update?: Database["public"]["Enums"]["disable_update"];
                disable_auto_update_under_native?: boolean;
                id?: number;
                ios?: boolean;
                name: string;
                owner_org: string;
                public?: boolean;
                updated_at?: string;
                version: number;
            };
            Update: {
                allow_dev?: boolean;
                allow_device?: boolean;
                allow_device_self_set?: boolean;
                allow_emulator?: boolean;
                allow_prod?: boolean;
                android?: boolean;
                app_id?: string;
                created_at?: string;
                created_by?: string;
                disable_auto_update?: Database["public"]["Enums"]["disable_update"];
                disable_auto_update_under_native?: boolean;
                id?: number;
                ios?: boolean;
                name?: string;
                owner_org?: string;
                public?: boolean;
                updated_at?: string;
                version?: number;
            };
            Relationships: [{
                foreignKeyName: "channels_app_id_fkey";
                columns: ["app_id"];
                isOneToOne: false;
                referencedRelation: "apps";
                referencedColumns: ["app_id"];
            }, {
                foreignKeyName: "channels_version_fkey";
                columns: ["version"];
                isOneToOne: false;
                referencedRelation: "app_versions";
                referencedColumns: ["id"];
            }, {
                foreignKeyName: "owner_org_id_fkey";
                columns: ["owner_org"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }];
        };
        cron_tasks: {
            Row: {
                batch_size: number | null;
                created_at: string;
                description: string | null;
                enabled: boolean;
                hour_interval: number | null;
                id: number;
                minute_interval: number | null;
                name: string;
                payload: import("./types/supabase.types").Json | null;
                run_at_hour: number | null;
                run_at_minute: number | null;
                run_at_second: number | null;
                run_on_day: number | null;
                run_on_dow: number | null;
                second_interval: number | null;
                target: string;
                task_type: Database["public"]["Enums"]["cron_task_type"];
                updated_at: string;
            };
            Insert: {
                batch_size?: number | null;
                created_at?: string;
                description?: string | null;
                enabled?: boolean;
                hour_interval?: number | null;
                id?: number;
                minute_interval?: number | null;
                name: string;
                payload?: import("./types/supabase.types").Json | null;
                run_at_hour?: number | null;
                run_at_minute?: number | null;
                run_at_second?: number | null;
                run_on_day?: number | null;
                run_on_dow?: number | null;
                second_interval?: number | null;
                target: string;
                task_type?: Database["public"]["Enums"]["cron_task_type"];
                updated_at?: string;
            };
            Update: {
                batch_size?: number | null;
                created_at?: string;
                description?: string | null;
                enabled?: boolean;
                hour_interval?: number | null;
                id?: number;
                minute_interval?: number | null;
                name?: string;
                payload?: import("./types/supabase.types").Json | null;
                run_at_hour?: number | null;
                run_at_minute?: number | null;
                run_at_second?: number | null;
                run_on_day?: number | null;
                run_on_dow?: number | null;
                second_interval?: number | null;
                target?: string;
                task_type?: Database["public"]["Enums"]["cron_task_type"];
                updated_at?: string;
            };
            Relationships: [];
        };
        daily_bandwidth: {
            Row: {
                app_id: string;
                bandwidth: number;
                date: string;
                id: number;
            };
            Insert: {
                app_id: string;
                bandwidth: number;
                date: string;
                id?: number;
            };
            Update: {
                app_id?: string;
                bandwidth?: number;
                date?: string;
                id?: number;
            };
            Relationships: [];
        };
        daily_build_time: {
            Row: {
                app_id: string;
                build_count: number;
                build_time_unit: number;
                date: string;
            };
            Insert: {
                app_id: string;
                build_count?: number;
                build_time_unit?: number;
                date: string;
            };
            Update: {
                app_id?: string;
                build_count?: number;
                build_time_unit?: number;
                date?: string;
            };
            Relationships: [{
                foreignKeyName: "daily_build_time_app_id_fkey";
                columns: ["app_id"];
                isOneToOne: false;
                referencedRelation: "apps";
                referencedColumns: ["app_id"];
            }];
        };
        daily_mau: {
            Row: {
                app_id: string;
                date: string;
                id: number;
                mau: number;
            };
            Insert: {
                app_id: string;
                date: string;
                id?: number;
                mau: number;
            };
            Update: {
                app_id?: string;
                date?: string;
                id?: number;
                mau?: number;
            };
            Relationships: [];
        };
        daily_storage: {
            Row: {
                app_id: string;
                date: string;
                id: number;
                storage: number;
            };
            Insert: {
                app_id: string;
                date: string;
                id?: number;
                storage: number;
            };
            Update: {
                app_id?: string;
                date?: string;
                id?: number;
                storage?: number;
            };
            Relationships: [];
        };
        daily_version: {
            Row: {
                app_id: string;
                date: string;
                fail: number | null;
                get: number | null;
                install: number | null;
                uninstall: number | null;
                version_id: number;
            };
            Insert: {
                app_id: string;
                date: string;
                fail?: number | null;
                get?: number | null;
                install?: number | null;
                uninstall?: number | null;
                version_id: number;
            };
            Update: {
                app_id?: string;
                date?: string;
                fail?: number | null;
                get?: number | null;
                install?: number | null;
                uninstall?: number | null;
                version_id?: number;
            };
            Relationships: [];
        };
        deleted_account: {
            Row: {
                created_at: string | null;
                email: string;
                id: string;
            };
            Insert: {
                created_at?: string | null;
                email?: string;
                id?: string;
            };
            Update: {
                created_at?: string | null;
                email?: string;
                id?: string;
            };
            Relationships: [];
        };
        deleted_apps: {
            Row: {
                app_id: string;
                created_at: string | null;
                deleted_at: string | null;
                id: number;
                owner_org: string;
            };
            Insert: {
                app_id: string;
                created_at?: string | null;
                deleted_at?: string | null;
                id?: number;
                owner_org: string;
            };
            Update: {
                app_id?: string;
                created_at?: string | null;
                deleted_at?: string | null;
                id?: number;
                owner_org?: string;
            };
            Relationships: [];
        };
        deploy_history: {
            Row: {
                app_id: string;
                channel_id: number;
                created_at: string | null;
                created_by: string;
                deployed_at: string | null;
                id: number;
                install_stats_email_sent_at: string | null;
                owner_org: string;
                updated_at: string | null;
                version_id: number;
            };
            Insert: {
                app_id: string;
                channel_id: number;
                created_at?: string | null;
                created_by: string;
                deployed_at?: string | null;
                id?: number;
                install_stats_email_sent_at?: string | null;
                owner_org: string;
                updated_at?: string | null;
                version_id: number;
            };
            Update: {
                app_id?: string;
                channel_id?: number;
                created_at?: string | null;
                created_by?: string;
                deployed_at?: string | null;
                id?: number;
                install_stats_email_sent_at?: string | null;
                owner_org?: string;
                updated_at?: string | null;
                version_id?: number;
            };
            Relationships: [{
                foreignKeyName: "deploy_history_app_id_fkey";
                columns: ["app_id"];
                isOneToOne: false;
                referencedRelation: "apps";
                referencedColumns: ["app_id"];
            }, {
                foreignKeyName: "deploy_history_channel_id_fkey";
                columns: ["channel_id"];
                isOneToOne: false;
                referencedRelation: "channels";
                referencedColumns: ["id"];
            }, {
                foreignKeyName: "deploy_history_created_by_fkey";
                columns: ["created_by"];
                isOneToOne: false;
                referencedRelation: "users";
                referencedColumns: ["id"];
            }, {
                foreignKeyName: "deploy_history_version_id_fkey";
                columns: ["version_id"];
                isOneToOne: false;
                referencedRelation: "app_versions";
                referencedColumns: ["id"];
            }];
        };
        device_usage: {
            Row: {
                app_id: string;
                device_id: string;
                id: number;
                org_id: string;
                timestamp: string;
            };
            Insert: {
                app_id: string;
                device_id: string;
                id?: number;
                org_id: string;
                timestamp?: string;
            };
            Update: {
                app_id?: string;
                device_id?: string;
                id?: number;
                org_id?: string;
                timestamp?: string;
            };
            Relationships: [];
        };
        devices: {
            Row: {
                app_id: string;
                custom_id: string;
                default_channel: string | null;
                device_id: string;
                id: number;
                is_emulator: boolean | null;
                is_prod: boolean | null;
                key_id: string | null;
                os_version: string | null;
                platform: Database["public"]["Enums"]["platform_os"];
                plugin_version: string;
                updated_at: string;
                version: number | null;
                version_build: string | null;
                version_name: string;
            };
            Insert: {
                app_id: string;
                custom_id?: string;
                default_channel?: string | null;
                device_id: string;
                id?: never;
                is_emulator?: boolean | null;
                is_prod?: boolean | null;
                key_id?: string | null;
                os_version?: string | null;
                platform: Database["public"]["Enums"]["platform_os"];
                plugin_version?: string;
                updated_at: string;
                version?: number | null;
                version_build?: string | null;
                version_name?: string;
            };
            Update: {
                app_id?: string;
                custom_id?: string;
                default_channel?: string | null;
                device_id?: string;
                id?: never;
                is_emulator?: boolean | null;
                is_prod?: boolean | null;
                key_id?: string | null;
                os_version?: string | null;
                platform?: Database["public"]["Enums"]["platform_os"];
                plugin_version?: string;
                updated_at?: string;
                version?: number | null;
                version_build?: string | null;
                version_name?: string;
            };
            Relationships: [];
        };
        global_stats: {
            Row: {
                apps: number;
                apps_active: number | null;
                bundle_storage_gb: number;
                canceled_orgs: number;
                created_at: string | null;
                credits_bought: number;
                credits_consumed: number;
                date_id: string;
                devices_last_month: number | null;
                mrr: number;
                need_upgrade: number | null;
                new_paying_orgs: number;
                not_paying: number | null;
                onboarded: number | null;
                paying: number | null;
                paying_monthly: number | null;
                paying_yearly: number | null;
                plan_enterprise: number | null;
                plan_enterprise_monthly: number;
                plan_enterprise_yearly: number;
                plan_maker: number | null;
                plan_maker_monthly: number;
                plan_maker_yearly: number;
                plan_solo: number | null;
                plan_solo_monthly: number;
                plan_solo_yearly: number;
                plan_team: number | null;
                plan_team_monthly: number;
                plan_team_yearly: number;
                registers_today: number;
                revenue_enterprise: number;
                revenue_maker: number;
                revenue_solo: number;
                revenue_team: number;
                stars: number;
                success_rate: number | null;
                total_revenue: number;
                trial: number | null;
                updates: number;
                updates_external: number | null;
                updates_last_month: number | null;
                users: number | null;
                users_active: number | null;
            };
            Insert: {
                apps: number;
                apps_active?: number | null;
                bundle_storage_gb?: number;
                canceled_orgs?: number;
                created_at?: string | null;
                credits_bought?: number;
                credits_consumed?: number;
                date_id: string;
                devices_last_month?: number | null;
                mrr?: number;
                need_upgrade?: number | null;
                new_paying_orgs?: number;
                not_paying?: number | null;
                onboarded?: number | null;
                paying?: number | null;
                paying_monthly?: number | null;
                paying_yearly?: number | null;
                plan_enterprise?: number | null;
                plan_enterprise_monthly?: number;
                plan_enterprise_yearly?: number;
                plan_maker?: number | null;
                plan_maker_monthly?: number;
                plan_maker_yearly?: number;
                plan_solo?: number | null;
                plan_solo_monthly?: number;
                plan_solo_yearly?: number;
                plan_team?: number | null;
                plan_team_monthly?: number;
                plan_team_yearly?: number;
                registers_today?: number;
                revenue_enterprise?: number;
                revenue_maker?: number;
                revenue_solo?: number;
                revenue_team?: number;
                stars: number;
                success_rate?: number | null;
                total_revenue?: number;
                trial?: number | null;
                updates: number;
                updates_external?: number | null;
                updates_last_month?: number | null;
                users?: number | null;
                users_active?: number | null;
            };
            Update: {
                apps?: number;
                apps_active?: number | null;
                bundle_storage_gb?: number;
                canceled_orgs?: number;
                created_at?: string | null;
                credits_bought?: number;
                credits_consumed?: number;
                date_id?: string;
                devices_last_month?: number | null;
                mrr?: number;
                need_upgrade?: number | null;
                new_paying_orgs?: number;
                not_paying?: number | null;
                onboarded?: number | null;
                paying?: number | null;
                paying_monthly?: number | null;
                paying_yearly?: number | null;
                plan_enterprise?: number | null;
                plan_enterprise_monthly?: number;
                plan_enterprise_yearly?: number;
                plan_maker?: number | null;
                plan_maker_monthly?: number;
                plan_maker_yearly?: number;
                plan_solo?: number | null;
                plan_solo_monthly?: number;
                plan_solo_yearly?: number;
                plan_team?: number | null;
                plan_team_monthly?: number;
                plan_team_yearly?: number;
                registers_today?: number;
                revenue_enterprise?: number;
                revenue_maker?: number;
                revenue_solo?: number;
                revenue_team?: number;
                stars?: number;
                success_rate?: number | null;
                total_revenue?: number;
                trial?: number | null;
                updates?: number;
                updates_external?: number | null;
                updates_last_month?: number | null;
                users?: number | null;
                users_active?: number | null;
            };
            Relationships: [];
        };
        manifest: {
            Row: {
                app_version_id: number;
                file_hash: string;
                file_name: string;
                file_size: number | null;
                id: number;
                s3_path: string;
            };
            Insert: {
                app_version_id: number;
                file_hash: string;
                file_name: string;
                file_size?: number | null;
                id?: number;
                s3_path: string;
            };
            Update: {
                app_version_id?: number;
                file_hash?: string;
                file_name?: string;
                file_size?: number | null;
                id?: number;
                s3_path?: string;
            };
            Relationships: [{
                foreignKeyName: "manifest_app_version_id_fkey";
                columns: ["app_version_id"];
                isOneToOne: false;
                referencedRelation: "app_versions";
                referencedColumns: ["id"];
            }];
        };
        notifications: {
            Row: {
                created_at: string | null;
                event: string;
                last_send_at: string;
                owner_org: string;
                total_send: number;
                uniq_id: string;
                updated_at: string | null;
            };
            Insert: {
                created_at?: string | null;
                event: string;
                last_send_at?: string;
                owner_org: string;
                total_send?: number;
                uniq_id: string;
                updated_at?: string | null;
            };
            Update: {
                created_at?: string | null;
                event?: string;
                last_send_at?: string;
                owner_org?: string;
                total_send?: number;
                uniq_id?: string;
                updated_at?: string | null;
            };
            Relationships: [{
                foreignKeyName: "owner_org_id_fkey";
                columns: ["owner_org"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }];
        };
        org_users: {
            Row: {
                app_id: string | null;
                channel_id: number | null;
                created_at: string | null;
                id: number;
                org_id: string;
                updated_at: string | null;
                user_id: string;
                user_right: Database["public"]["Enums"]["user_min_right"] | null;
            };
            Insert: {
                app_id?: string | null;
                channel_id?: number | null;
                created_at?: string | null;
                id?: number;
                org_id: string;
                updated_at?: string | null;
                user_id: string;
                user_right?: Database["public"]["Enums"]["user_min_right"] | null;
            };
            Update: {
                app_id?: string | null;
                channel_id?: number | null;
                created_at?: string | null;
                id?: number;
                org_id?: string;
                updated_at?: string | null;
                user_id?: string;
                user_right?: Database["public"]["Enums"]["user_min_right"] | null;
            };
            Relationships: [{
                foreignKeyName: "org_users_app_id_fkey";
                columns: ["app_id"];
                isOneToOne: false;
                referencedRelation: "apps";
                referencedColumns: ["app_id"];
            }, {
                foreignKeyName: "org_users_channel_id_fkey";
                columns: ["channel_id"];
                isOneToOne: false;
                referencedRelation: "channels";
                referencedColumns: ["id"];
            }, {
                foreignKeyName: "org_users_org_id_fkey";
                columns: ["org_id"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }, {
                foreignKeyName: "org_users_user_id_fkey";
                columns: ["user_id"];
                isOneToOne: false;
                referencedRelation: "users";
                referencedColumns: ["id"];
            }];
        };
        orgs: {
            Row: {
                created_at: string | null;
                created_by: string;
                customer_id: string | null;
                email_preferences: import("./types/supabase.types").Json;
                enforce_hashed_api_keys: boolean;
                enforcing_2fa: boolean;
                id: string;
                last_stats_updated_at: string | null;
                logo: string | null;
                management_email: string;
                max_apikey_expiration_days: number | null;
                name: string;
                password_policy_config: import("./types/supabase.types").Json | null;
                require_apikey_expiration: boolean;
                stats_updated_at: string | null;
                updated_at: string | null;
            };
            Insert: {
                created_at?: string | null;
                created_by: string;
                customer_id?: string | null;
                email_preferences?: import("./types/supabase.types").Json;
                enforce_hashed_api_keys?: boolean;
                enforcing_2fa?: boolean;
                id?: string;
                last_stats_updated_at?: string | null;
                logo?: string | null;
                management_email: string;
                max_apikey_expiration_days?: number | null;
                name: string;
                password_policy_config?: import("./types/supabase.types").Json | null;
                require_apikey_expiration?: boolean;
                stats_updated_at?: string | null;
                updated_at?: string | null;
            };
            Update: {
                created_at?: string | null;
                created_by?: string;
                customer_id?: string | null;
                email_preferences?: import("./types/supabase.types").Json;
                enforce_hashed_api_keys?: boolean;
                enforcing_2fa?: boolean;
                id?: string;
                last_stats_updated_at?: string | null;
                logo?: string | null;
                management_email?: string;
                max_apikey_expiration_days?: number | null;
                name?: string;
                password_policy_config?: import("./types/supabase.types").Json | null;
                require_apikey_expiration?: boolean;
                stats_updated_at?: string | null;
                updated_at?: string | null;
            };
            Relationships: [{
                foreignKeyName: "orgs_created_by_fkey";
                columns: ["created_by"];
                isOneToOne: false;
                referencedRelation: "users";
                referencedColumns: ["id"];
            }, {
                foreignKeyName: "orgs_customer_id_fkey";
                columns: ["customer_id"];
                isOneToOne: true;
                referencedRelation: "stripe_info";
                referencedColumns: ["customer_id"];
            }];
        };
        plans: {
            Row: {
                bandwidth: number;
                build_time_unit: number;
                created_at: string;
                credit_id: string;
                description: string;
                id: string;
                market_desc: string | null;
                mau: number;
                name: string;
                price_m: number;
                price_m_id: string;
                price_y: number;
                price_y_id: string;
                storage: number;
                stripe_id: string;
                updated_at: string;
            };
            Insert: {
                bandwidth: number;
                build_time_unit?: number;
                created_at?: string;
                credit_id: string;
                description?: string;
                id?: string;
                market_desc?: string | null;
                mau?: number;
                name?: string;
                price_m?: number;
                price_m_id: string;
                price_y?: number;
                price_y_id: string;
                storage: number;
                stripe_id?: string;
                updated_at?: string;
            };
            Update: {
                bandwidth?: number;
                build_time_unit?: number;
                created_at?: string;
                credit_id?: string;
                description?: string;
                id?: string;
                market_desc?: string | null;
                mau?: number;
                name?: string;
                price_m?: number;
                price_m_id?: string;
                price_y?: number;
                price_y_id?: string;
                storage?: number;
                stripe_id?: string;
                updated_at?: string;
            };
            Relationships: [];
        };
        stats: {
            Row: {
                action: Database["public"]["Enums"]["stats_action"];
                app_id: string;
                created_at: string;
                device_id: string;
                id: number;
                version_name: string;
            };
            Insert: {
                action: Database["public"]["Enums"]["stats_action"];
                app_id: string;
                created_at: string;
                device_id: string;
                id?: never;
                version_name?: string;
            };
            Update: {
                action?: Database["public"]["Enums"]["stats_action"];
                app_id?: string;
                created_at?: string;
                device_id?: string;
                id?: never;
                version_name?: string;
            };
            Relationships: [];
        };
        storage_usage: {
            Row: {
                app_id: string;
                device_id: string;
                file_size: number;
                id: number;
                timestamp: string;
            };
            Insert: {
                app_id: string;
                device_id: string;
                file_size: number;
                id?: number;
                timestamp?: string;
            };
            Update: {
                app_id?: string;
                device_id?: string;
                file_size?: number;
                id?: number;
                timestamp?: string;
            };
            Relationships: [];
        };
        stripe_info: {
            Row: {
                bandwidth_exceeded: boolean | null;
                build_time_exceeded: boolean | null;
                canceled_at: string | null;
                created_at: string;
                customer_id: string;
                id: number;
                is_good_plan: boolean | null;
                mau_exceeded: boolean | null;
                plan_calculated_at: string | null;
                plan_usage: number | null;
                price_id: string | null;
                product_id: string;
                status: Database["public"]["Enums"]["stripe_status"] | null;
                storage_exceeded: boolean | null;
                subscription_anchor_end: string;
                subscription_anchor_start: string;
                subscription_id: string | null;
                subscription_metered: import("./types/supabase.types").Json;
                trial_at: string;
                updated_at: string;
            };
            Insert: {
                bandwidth_exceeded?: boolean | null;
                build_time_exceeded?: boolean | null;
                canceled_at?: string | null;
                created_at?: string;
                customer_id: string;
                id?: number;
                is_good_plan?: boolean | null;
                mau_exceeded?: boolean | null;
                plan_calculated_at?: string | null;
                plan_usage?: number | null;
                price_id?: string | null;
                product_id: string;
                status?: Database["public"]["Enums"]["stripe_status"] | null;
                storage_exceeded?: boolean | null;
                subscription_anchor_end?: string;
                subscription_anchor_start?: string;
                subscription_id?: string | null;
                subscription_metered?: import("./types/supabase.types").Json;
                trial_at?: string;
                updated_at?: string;
            };
            Update: {
                bandwidth_exceeded?: boolean | null;
                build_time_exceeded?: boolean | null;
                canceled_at?: string | null;
                created_at?: string;
                customer_id?: string;
                id?: number;
                is_good_plan?: boolean | null;
                mau_exceeded?: boolean | null;
                plan_calculated_at?: string | null;
                plan_usage?: number | null;
                price_id?: string | null;
                product_id?: string;
                status?: Database["public"]["Enums"]["stripe_status"] | null;
                storage_exceeded?: boolean | null;
                subscription_anchor_end?: string;
                subscription_anchor_start?: string;
                subscription_id?: string | null;
                subscription_metered?: import("./types/supabase.types").Json;
                trial_at?: string;
                updated_at?: string;
            };
            Relationships: [{
                foreignKeyName: "stripe_info_product_id_fkey";
                columns: ["product_id"];
                isOneToOne: false;
                referencedRelation: "plans";
                referencedColumns: ["stripe_id"];
            }];
        };
        tmp_users: {
            Row: {
                cancelled_at: string | null;
                created_at: string;
                email: string;
                first_name: string;
                future_uuid: string;
                id: number;
                invite_magic_string: string;
                last_name: string;
                org_id: string;
                role: Database["public"]["Enums"]["user_min_right"];
                updated_at: string;
            };
            Insert: {
                cancelled_at?: string | null;
                created_at?: string;
                email: string;
                first_name: string;
                future_uuid?: string;
                id?: number;
                invite_magic_string?: string;
                last_name: string;
                org_id: string;
                role: Database["public"]["Enums"]["user_min_right"];
                updated_at?: string;
            };
            Update: {
                cancelled_at?: string | null;
                created_at?: string;
                email?: string;
                first_name?: string;
                future_uuid?: string;
                id?: number;
                invite_magic_string?: string;
                last_name?: string;
                org_id?: string;
                role?: Database["public"]["Enums"]["user_min_right"];
                updated_at?: string;
            };
            Relationships: [{
                foreignKeyName: "tmp_users_org_id_fkey";
                columns: ["org_id"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }];
        };
        to_delete_accounts: {
            Row: {
                account_id: string;
                created_at: string;
                id: number;
                removal_date: string;
                removed_data: import("./types/supabase.types").Json | null;
            };
            Insert: {
                account_id: string;
                created_at?: string;
                id?: number;
                removal_date: string;
                removed_data?: import("./types/supabase.types").Json | null;
            };
            Update: {
                account_id?: string;
                created_at?: string;
                id?: number;
                removal_date?: string;
                removed_data?: import("./types/supabase.types").Json | null;
            };
            Relationships: [{
                foreignKeyName: "to_delete_accounts_account_id_fkey";
                columns: ["account_id"];
                isOneToOne: false;
                referencedRelation: "users";
                referencedColumns: ["id"];
            }];
        };
        usage_credit_consumptions: {
            Row: {
                applied_at: string;
                credits_used: number;
                grant_id: string;
                id: number;
                metric: Database["public"]["Enums"]["credit_metric_type"];
                org_id: string;
                overage_event_id: string | null;
            };
            Insert: {
                applied_at?: string;
                credits_used: number;
                grant_id: string;
                id?: number;
                metric: Database["public"]["Enums"]["credit_metric_type"];
                org_id: string;
                overage_event_id?: string | null;
            };
            Update: {
                applied_at?: string;
                credits_used?: number;
                grant_id?: string;
                id?: number;
                metric?: Database["public"]["Enums"]["credit_metric_type"];
                org_id?: string;
                overage_event_id?: string | null;
            };
            Relationships: [{
                foreignKeyName: "usage_credit_consumptions_grant_id_fkey";
                columns: ["grant_id"];
                isOneToOne: false;
                referencedRelation: "usage_credit_grants";
                referencedColumns: ["id"];
            }, {
                foreignKeyName: "usage_credit_consumptions_org_id_fkey";
                columns: ["org_id"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }, {
                foreignKeyName: "usage_credit_consumptions_overage_event_id_fkey";
                columns: ["overage_event_id"];
                isOneToOne: false;
                referencedRelation: "usage_overage_events";
                referencedColumns: ["id"];
            }];
        };
        usage_credit_grants: {
            Row: {
                credits_consumed: number;
                credits_total: number;
                expires_at: string;
                granted_at: string;
                id: string;
                notes: string | null;
                org_id: string;
                source: string;
                source_ref: import("./types/supabase.types").Json | null;
            };
            Insert: {
                credits_consumed?: number;
                credits_total: number;
                expires_at?: string;
                granted_at?: string;
                id?: string;
                notes?: string | null;
                org_id: string;
                source?: string;
                source_ref?: import("./types/supabase.types").Json | null;
            };
            Update: {
                credits_consumed?: number;
                credits_total?: number;
                expires_at?: string;
                granted_at?: string;
                id?: string;
                notes?: string | null;
                org_id?: string;
                source?: string;
                source_ref?: import("./types/supabase.types").Json | null;
            };
            Relationships: [{
                foreignKeyName: "usage_credit_grants_org_id_fkey";
                columns: ["org_id"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }];
        };
        usage_credit_transactions: {
            Row: {
                amount: number;
                balance_after: number | null;
                description: string | null;
                grant_id: string | null;
                id: number;
                occurred_at: string;
                org_id: string;
                source_ref: import("./types/supabase.types").Json | null;
                transaction_type: Database["public"]["Enums"]["credit_transaction_type"];
            };
            Insert: {
                amount: number;
                balance_after?: number | null;
                description?: string | null;
                grant_id?: string | null;
                id?: number;
                occurred_at?: string;
                org_id: string;
                source_ref?: import("./types/supabase.types").Json | null;
                transaction_type: Database["public"]["Enums"]["credit_transaction_type"];
            };
            Update: {
                amount?: number;
                balance_after?: number | null;
                description?: string | null;
                grant_id?: string | null;
                id?: number;
                occurred_at?: string;
                org_id?: string;
                source_ref?: import("./types/supabase.types").Json | null;
                transaction_type?: Database["public"]["Enums"]["credit_transaction_type"];
            };
            Relationships: [{
                foreignKeyName: "usage_credit_transactions_grant_id_fkey";
                columns: ["grant_id"];
                isOneToOne: false;
                referencedRelation: "usage_credit_grants";
                referencedColumns: ["id"];
            }, {
                foreignKeyName: "usage_credit_transactions_org_id_fkey";
                columns: ["org_id"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }];
        };
        usage_overage_events: {
            Row: {
                billing_cycle_end: string | null;
                billing_cycle_start: string | null;
                created_at: string;
                credit_step_id: number | null;
                credits_debited: number;
                credits_estimated: number;
                details: import("./types/supabase.types").Json | null;
                id: string;
                metric: Database["public"]["Enums"]["credit_metric_type"];
                org_id: string;
                overage_amount: number;
            };
            Insert: {
                billing_cycle_end?: string | null;
                billing_cycle_start?: string | null;
                created_at?: string;
                credit_step_id?: number | null;
                credits_debited?: number;
                credits_estimated: number;
                details?: import("./types/supabase.types").Json | null;
                id?: string;
                metric: Database["public"]["Enums"]["credit_metric_type"];
                org_id: string;
                overage_amount: number;
            };
            Update: {
                billing_cycle_end?: string | null;
                billing_cycle_start?: string | null;
                created_at?: string;
                credit_step_id?: number | null;
                credits_debited?: number;
                credits_estimated?: number;
                details?: import("./types/supabase.types").Json | null;
                id?: string;
                metric?: Database["public"]["Enums"]["credit_metric_type"];
                org_id?: string;
                overage_amount?: number;
            };
            Relationships: [{
                foreignKeyName: "usage_overage_events_credit_step_id_fkey";
                columns: ["credit_step_id"];
                isOneToOne: false;
                referencedRelation: "capgo_credits_steps";
                referencedColumns: ["id"];
            }, {
                foreignKeyName: "usage_overage_events_org_id_fkey";
                columns: ["org_id"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }];
        };
        user_password_compliance: {
            Row: {
                created_at: string;
                id: number;
                org_id: string;
                policy_hash: string;
                updated_at: string;
                user_id: string;
                validated_at: string;
            };
            Insert: {
                created_at?: string;
                id?: number;
                org_id: string;
                policy_hash: string;
                updated_at?: string;
                user_id: string;
                validated_at?: string;
            };
            Update: {
                created_at?: string;
                id?: number;
                org_id?: string;
                policy_hash?: string;
                updated_at?: string;
                user_id?: string;
                validated_at?: string;
            };
            Relationships: [{
                foreignKeyName: "user_password_compliance_org_id_fkey";
                columns: ["org_id"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }];
        };
        users: {
            Row: {
                ban_time: string | null;
                country: string | null;
                created_at: string | null;
                email: string;
                email_preferences: import("./types/supabase.types").Json;
                enable_notifications: boolean;
                first_name: string | null;
                id: string;
                image_url: string | null;
                last_name: string | null;
                opt_for_newsletters: boolean;
                updated_at: string | null;
            };
            Insert: {
                ban_time?: string | null;
                country?: string | null;
                created_at?: string | null;
                email: string;
                email_preferences?: import("./types/supabase.types").Json;
                enable_notifications?: boolean;
                first_name?: string | null;
                id: string;
                image_url?: string | null;
                last_name?: string | null;
                opt_for_newsletters?: boolean;
                updated_at?: string | null;
            };
            Update: {
                ban_time?: string | null;
                country?: string | null;
                created_at?: string | null;
                email?: string;
                email_preferences?: import("./types/supabase.types").Json;
                enable_notifications?: boolean;
                first_name?: string | null;
                id?: string;
                image_url?: string | null;
                last_name?: string | null;
                opt_for_newsletters?: boolean;
                updated_at?: string | null;
            };
            Relationships: [];
        };
        version_meta: {
            Row: {
                app_id: string;
                size: number;
                timestamp: string;
                version_id: number;
            };
            Insert: {
                app_id: string;
                size: number;
                timestamp?: string;
                version_id: number;
            };
            Update: {
                app_id?: string;
                size?: number;
                timestamp?: string;
                version_id?: number;
            };
            Relationships: [];
        };
        version_usage: {
            Row: {
                action: Database["public"]["Enums"]["version_action"];
                app_id: string;
                timestamp: string;
                version_id: number;
            };
            Insert: {
                action: Database["public"]["Enums"]["version_action"];
                app_id: string;
                timestamp?: string;
                version_id: number;
            };
            Update: {
                action?: Database["public"]["Enums"]["version_action"];
                app_id?: string;
                timestamp?: string;
                version_id?: number;
            };
            Relationships: [];
        };
        webhook_deliveries: {
            Row: {
                attempt_count: number;
                audit_log_id: number | null;
                completed_at: string | null;
                created_at: string;
                duration_ms: number | null;
                event_type: string;
                id: string;
                max_attempts: number;
                next_retry_at: string | null;
                org_id: string;
                request_payload: import("./types/supabase.types").Json;
                response_body: string | null;
                response_headers: import("./types/supabase.types").Json | null;
                response_status: number | null;
                status: string;
                webhook_id: string;
            };
            Insert: {
                attempt_count?: number;
                audit_log_id?: number | null;
                completed_at?: string | null;
                created_at?: string;
                duration_ms?: number | null;
                event_type: string;
                id?: string;
                max_attempts?: number;
                next_retry_at?: string | null;
                org_id: string;
                request_payload: import("./types/supabase.types").Json;
                response_body?: string | null;
                response_headers?: import("./types/supabase.types").Json | null;
                response_status?: number | null;
                status?: string;
                webhook_id: string;
            };
            Update: {
                attempt_count?: number;
                audit_log_id?: number | null;
                completed_at?: string | null;
                created_at?: string;
                duration_ms?: number | null;
                event_type?: string;
                id?: string;
                max_attempts?: number;
                next_retry_at?: string | null;
                org_id?: string;
                request_payload?: import("./types/supabase.types").Json;
                response_body?: string | null;
                response_headers?: import("./types/supabase.types").Json | null;
                response_status?: number | null;
                status?: string;
                webhook_id?: string;
            };
            Relationships: [{
                foreignKeyName: "webhook_deliveries_org_id_fkey";
                columns: ["org_id"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }, {
                foreignKeyName: "webhook_deliveries_webhook_id_fkey";
                columns: ["webhook_id"];
                isOneToOne: false;
                referencedRelation: "webhooks";
                referencedColumns: ["id"];
            }];
        };
        webhooks: {
            Row: {
                created_at: string;
                created_by: string | null;
                enabled: boolean;
                events: string[];
                id: string;
                name: string;
                org_id: string;
                secret: string;
                updated_at: string;
                url: string;
            };
            Insert: {
                created_at?: string;
                created_by?: string | null;
                enabled?: boolean;
                events: string[];
                id?: string;
                name: string;
                org_id: string;
                secret?: string;
                updated_at?: string;
                url: string;
            };
            Update: {
                created_at?: string;
                created_by?: string | null;
                enabled?: boolean;
                events?: string[];
                id?: string;
                name?: string;
                org_id?: string;
                secret?: string;
                updated_at?: string;
                url?: string;
            };
            Relationships: [{
                foreignKeyName: "webhooks_created_by_fkey";
                columns: ["created_by"];
                isOneToOne: false;
                referencedRelation: "users";
                referencedColumns: ["id"];
            }, {
                foreignKeyName: "webhooks_org_id_fkey";
                columns: ["org_id"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }];
        };
    };
    Views: {
        usage_credit_balances: {
            Row: {
                available_credits: number | null;
                next_expiration: string | null;
                org_id: string | null;
                total_credits: number | null;
            };
            Relationships: [{
                foreignKeyName: "usage_credit_grants_org_id_fkey";
                columns: ["org_id"];
                isOneToOne: false;
                referencedRelation: "orgs";
                referencedColumns: ["id"];
            }];
        };
        usage_credit_ledger: {
            Row: {
                amount: number | null;
                balance_after: number | null;
                billing_cycle_end: string | null;
                billing_cycle_start: string | null;
                description: string | null;
                details: import("./types/supabase.types").Json | null;
                grant_allocations: import("./types/supabase.types").Json | null;
                id: number | null;
                metric: Database["public"]["Enums"]["credit_metric_type"] | null;
                occurred_at: string | null;
                org_id: string | null;
                overage_amount: number | null;
                overage_event_id: string | null;
                source_ref: import("./types/supabase.types").Json | null;
                transaction_type: Database["public"]["Enums"]["credit_transaction_type"] | null;
            };
            Relationships: [];
        };
    };
    Functions: {
        accept_invitation_to_org: {
            Args: {
                org_id: string;
            };
            Returns: string;
        };
        apply_usage_overage: {
            Args: {
                p_billing_cycle_end: string;
                p_billing_cycle_start: string;
                p_details?: import("./types/supabase.types").Json;
                p_metric: Database["public"]["Enums"]["credit_metric_type"];
                p_org_id: string;
                p_overage_amount: number;
            };
            Returns: {
                credit_step_id: number;
                credits_applied: number;
                credits_remaining: number;
                credits_required: number;
                overage_amount: number;
                overage_covered: number;
                overage_event_id: string;
                overage_unpaid: number;
            }[];
        };
        calculate_credit_cost: {
            Args: {
                p_metric: Database["public"]["Enums"]["credit_metric_type"];
                p_overage_amount: number;
            };
            Returns: {
                credit_cost_per_unit: number;
                credit_step_id: number;
                credits_required: number;
            }[];
        };
        check_min_rights: {
            Args: {
                app_id: string;
                channel_id: number;
                min_right: Database["public"]["Enums"]["user_min_right"];
                org_id: string;
            };
            Returns: boolean;
        } | {
            Args: {
                app_id: string;
                channel_id: number;
                min_right: Database["public"]["Enums"]["user_min_right"];
                org_id: string;
                user_id: string;
            };
            Returns: boolean;
        };
        check_org_hashed_key_enforcement: {
            Args: {
                apikey_row: Database["public"]["Tables"]["apikeys"]["Row"];
                org_id: string;
            };
            Returns: boolean;
        };
        check_org_members_2fa_enabled: {
            Args: {
                org_id: string;
            };
            Returns: {
                "2fa_enabled": boolean;
                user_id: string;
            }[];
        };
        check_org_members_password_policy: {
            Args: {
                org_id: string;
            };
            Returns: {
                email: string;
                first_name: string;
                last_name: string;
                password_policy_compliant: boolean;
                user_id: string;
            }[];
        };
        check_revert_to_builtin_version: {
            Args: {
                appid: string;
            };
            Returns: number;
        };
        cleanup_expired_apikeys: {
            Args: never;
            Returns: undefined;
        };
        cleanup_frequent_job_details: {
            Args: never;
            Returns: undefined;
        };
        cleanup_job_run_details_7days: {
            Args: never;
            Returns: undefined;
        };
        cleanup_old_audit_logs: {
            Args: never;
            Returns: undefined;
        };
        cleanup_queue_messages: {
            Args: never;
            Returns: undefined;
        };
        cleanup_webhook_deliveries: {
            Args: never;
            Returns: undefined;
        };
        convert_bytes_to_gb: {
            Args: {
                bytes_value: number;
            };
            Returns: number;
        };
        convert_bytes_to_mb: {
            Args: {
                bytes_value: number;
            };
            Returns: number;
        };
        convert_gb_to_bytes: {
            Args: {
                gb: number;
            };
            Returns: number;
        };
        convert_mb_to_bytes: {
            Args: {
                gb: number;
            };
            Returns: number;
        };
        convert_number_to_percent: {
            Args: {
                max_val: number;
                val: number;
            };
            Returns: number;
        };
        count_active_users: {
            Args: {
                app_ids: string[];
            };
            Returns: number;
        };
        count_all_need_upgrade: {
            Args: never;
            Returns: number;
        };
        count_all_onboarded: {
            Args: never;
            Returns: number;
        };
        count_all_plans_v2: {
            Args: never;
            Returns: {
                count: number;
                plan_name: string;
            }[];
        };
        delete_accounts_marked_for_deletion: {
            Args: never;
            Returns: {
                deleted_count: number;
                deleted_user_ids: string[];
            }[];
        };
        delete_http_response: {
            Args: {
                request_id: number;
            };
            Returns: undefined;
        };
        delete_old_deleted_apps: {
            Args: never;
            Returns: undefined;
        };
        delete_user: {
            Args: never;
            Returns: undefined;
        };
        exist_app_v2: {
            Args: {
                appid: string;
            };
            Returns: boolean;
        };
        exist_app_versions: {
            Args: {
                appid: string;
                name_version: string;
            };
            Returns: boolean;
        } | {
            Args: {
                apikey: string;
                appid: string;
                name_version: string;
            };
            Returns: boolean;
        };
        expire_usage_credits: {
            Args: never;
            Returns: number;
        };
        find_apikey_by_value: {
            Args: {
                key_value: string;
            };
            Returns: {
                created_at: string | null;
                expires_at: string | null;
                id: number;
                key: string | null;
                key_hash: string | null;
                limited_to_apps: string[] | null;
                limited_to_orgs: string[] | null;
                mode: Database["public"]["Enums"]["key_mode"];
                name: string;
                updated_at: string | null;
                user_id: string;
            }[];
            SetofOptions: {
                from: "*";
                to: "apikeys";
                isOneToOne: false;
                isSetofReturn: true;
            };
        };
        find_best_plan_v3: {
            Args: {
                bandwidth: number;
                build_time_unit?: number;
                mau: number;
                storage: number;
            };
            Returns: string;
        };
        find_fit_plan_v3: {
            Args: {
                bandwidth: number;
                build_time_unit?: number;
                mau: number;
                storage: number;
            };
            Returns: {
                name: string;
            }[];
        };
        get_account_removal_date: {
            Args: {
                user_id: string;
            };
            Returns: string;
        };
        get_apikey: {
            Args: never;
            Returns: string;
        };
        get_apikey_header: {
            Args: never;
            Returns: string;
        };
        get_app_metrics: {
            Args: {
                org_id: string;
            };
            Returns: {
                app_id: string;
                bandwidth: number;
                build_time_unit: number;
                date: string;
                fail: number;
                get: number;
                install: number;
                mau: number;
                storage: number;
                uninstall: number;
            }[];
        } | {
            Args: {
                end_date: string;
                org_id: string;
                start_date: string;
            };
            Returns: {
                app_id: string;
                bandwidth: number;
                build_time_unit: number;
                date: string;
                fail: number;
                get: number;
                install: number;
                mau: number;
                storage: number;
                uninstall: number;
            }[];
        };
        get_app_versions: {
            Args: {
                apikey: string;
                appid: string;
                name_version: string;
            };
            Returns: number;
        };
        get_current_plan_max_org: {
            Args: {
                orgid: string;
            };
            Returns: {
                bandwidth: number;
                build_time_unit: number;
                mau: number;
                storage: number;
            }[];
        };
        get_current_plan_name_org: {
            Args: {
                orgid: string;
            };
            Returns: string;
        };
        get_customer_counts: {
            Args: never;
            Returns: {
                monthly: number;
                total: number;
                yearly: number;
            }[];
        };
        get_cycle_info_org: {
            Args: {
                orgid: string;
            };
            Returns: {
                subscription_anchor_end: string;
                subscription_anchor_start: string;
            }[];
        };
        get_db_url: {
            Args: never;
            Returns: string;
        };
        get_global_metrics: {
            Args: {
                org_id: string;
            };
            Returns: {
                bandwidth: number;
                date: string;
                fail: number;
                get: number;
                install: number;
                mau: number;
                storage: number;
                uninstall: number;
            }[];
        } | {
            Args: {
                end_date: string;
                org_id: string;
                start_date: string;
            };
            Returns: {
                bandwidth: number;
                date: string;
                fail: number;
                get: number;
                install: number;
                mau: number;
                storage: number;
                uninstall: number;
            }[];
        };
        get_identity: {
            Args: never;
            Returns: string;
        } | {
            Args: {
                keymode: Database["public"]["Enums"]["key_mode"][];
            };
            Returns: string;
        };
        get_identity_apikey_only: {
            Args: {
                keymode: Database["public"]["Enums"]["key_mode"][];
            };
            Returns: string;
        };
        get_identity_org_allowed: {
            Args: {
                keymode: Database["public"]["Enums"]["key_mode"][];
                org_id: string;
            };
            Returns: string;
        };
        get_identity_org_appid: {
            Args: {
                app_id: string;
                keymode: Database["public"]["Enums"]["key_mode"][];
                org_id: string;
            };
            Returns: string;
        };
        get_invite_by_magic_lookup: {
            Args: {
                lookup: string;
            };
            Returns: {
                org_logo: string;
                org_name: string;
                role: Database["public"]["Enums"]["user_min_right"];
            }[];
        };
        get_metered_usage: {
            Args: never;
            Returns: Database["public"]["CompositeTypes"]["stats_table"];
            SetofOptions: {
                from: "*";
                to: "stats_table";
                isOneToOne: true;
                isSetofReturn: false;
            };
        } | {
            Args: {
                orgid: string;
            };
            Returns: Database["public"]["CompositeTypes"]["stats_table"];
            SetofOptions: {
                from: "*";
                to: "stats_table";
                isOneToOne: true;
                isSetofReturn: false;
            };
        };
        get_next_cron_time: {
            Args: {
                p_schedule: string;
                p_timestamp: string;
            };
            Returns: string;
        };
        get_next_cron_value: {
            Args: {
                current_val: number;
                max_val: number;
                pattern: string;
            };
            Returns: number;
        };
        get_next_stats_update_date: {
            Args: {
                org: string;
            };
            Returns: string;
        };
        get_org_build_time_unit: {
            Args: {
                p_end_date: string;
                p_org_id: string;
                p_start_date: string;
            };
            Returns: {
                total_build_time_unit: number;
                total_builds: number;
            }[];
        };
        get_org_members: {
            Args: {
                guild_id: string;
            };
            Returns: {
                aid: number;
                email: string;
                image_url: string;
                is_tmp: boolean;
                role: Database["public"]["Enums"]["user_min_right"];
                uid: string;
            }[];
        } | {
            Args: {
                guild_id: string;
                user_id: string;
            };
            Returns: {
                aid: number;
                email: string;
                image_url: string;
                is_tmp: boolean;
                role: Database["public"]["Enums"]["user_min_right"];
                uid: string;
            }[];
        };
        get_org_owner_id: {
            Args: {
                apikey: string;
                app_id: string;
            };
            Returns: string;
        };
        get_org_perm_for_apikey: {
            Args: {
                apikey: string;
                app_id: string;
            };
            Returns: string;
        };
        get_organization_cli_warnings: {
            Args: {
                cli_version: string;
                orgid: string;
            };
            Returns: import("./types/supabase.types").Json[];
        };
        get_orgs_v6: {
            Args: never;
            Returns: {
                app_count: number;
                can_use_more: boolean;
                created_by: string;
                credit_available: number;
                credit_next_expiration: string;
                credit_total: number;
                gid: string;
                is_canceled: boolean;
                is_yearly: boolean;
                logo: string;
                management_email: string;
                max_apikey_expiration_days: number;
                name: string;
                next_stats_update_at: string;
                paying: boolean;
                require_apikey_expiration: boolean;
                role: string;
                stats_updated_at: string;
                subscription_end: string;
                subscription_start: string;
                trial_left: number;
            }[];
        } | {
            Args: {
                userid: string;
            };
            Returns: {
                app_count: number;
                can_use_more: boolean;
                created_by: string;
                credit_available: number;
                credit_next_expiration: string;
                credit_total: number;
                gid: string;
                is_canceled: boolean;
                is_yearly: boolean;
                logo: string;
                management_email: string;
                max_apikey_expiration_days: number;
                name: string;
                next_stats_update_at: string;
                paying: boolean;
                require_apikey_expiration: boolean;
                role: string;
                stats_updated_at: string;
                subscription_end: string;
                subscription_start: string;
                trial_left: number;
            }[];
        };
        get_orgs_v7: {
            Args: never;
            Returns: {
                "2fa_has_access": boolean;
                app_count: number;
                can_use_more: boolean;
                created_by: string;
                credit_available: number;
                credit_next_expiration: string;
                credit_total: number;
                enforce_hashed_api_keys: boolean;
                enforcing_2fa: boolean;
                gid: string;
                is_canceled: boolean;
                is_yearly: boolean;
                logo: string;
                management_email: string;
                name: string;
                next_stats_update_at: string;
                password_has_access: boolean;
                password_policy_config: import("./types/supabase.types").Json;
                paying: boolean;
                role: string;
                stats_updated_at: string;
                subscription_end: string;
                subscription_start: string;
                trial_left: number;
            }[];
        } | {
            Args: {
                userid: string;
            };
            Returns: {
                "2fa_has_access": boolean;
                app_count: number;
                can_use_more: boolean;
                created_by: string;
                credit_available: number;
                credit_next_expiration: string;
                credit_total: number;
                enforce_hashed_api_keys: boolean;
                enforcing_2fa: boolean;
                gid: string;
                is_canceled: boolean;
                is_yearly: boolean;
                logo: string;
                management_email: string;
                name: string;
                next_stats_update_at: string;
                password_has_access: boolean;
                password_policy_config: import("./types/supabase.types").Json;
                paying: boolean;
                role: string;
                stats_updated_at: string;
                subscription_end: string;
                subscription_start: string;
                trial_left: number;
            }[];
        };
        get_password_policy_hash: {
            Args: {
                policy_config: import("./types/supabase.types").Json;
            };
            Returns: string;
        };
        get_plan_usage_percent_detailed: {
            Args: {
                orgid: string;
            };
            Returns: {
                bandwidth_percent: number;
                build_time_percent: number;
                mau_percent: number;
                storage_percent: number;
                total_percent: number;
            }[];
        } | {
            Args: {
                cycle_end: string;
                cycle_start: string;
                orgid: string;
            };
            Returns: {
                bandwidth_percent: number;
                build_time_percent: number;
                mau_percent: number;
                storage_percent: number;
                total_percent: number;
            }[];
        };
        get_total_app_storage_size_orgs: {
            Args: {
                app_id: string;
                org_id: string;
            };
            Returns: number;
        };
        get_total_metrics: {
            Args: {
                org_id: string;
            };
            Returns: {
                bandwidth: number;
                build_time_unit: number;
                fail: number;
                get: number;
                install: number;
                mau: number;
                storage: number;
                uninstall: number;
            }[];
        } | {
            Args: {
                end_date: string;
                org_id: string;
                start_date: string;
            };
            Returns: {
                bandwidth: number;
                build_time_unit: number;
                fail: number;
                get: number;
                install: number;
                mau: number;
                storage: number;
                uninstall: number;
            }[];
        };
        get_total_storage_size_org: {
            Args: {
                org_id: string;
            };
            Returns: number;
        };
        get_update_stats: {
            Args: never;
            Returns: {
                app_id: string;
                failed: number;
                get: number;
                healthy: boolean;
                install: number;
                success_rate: number;
            }[];
        };
        get_user_id: {
            Args: {
                apikey: string;
            };
            Returns: string;
        } | {
            Args: {
                apikey: string;
                app_id: string;
            };
            Returns: string;
        };
        get_user_main_org_id: {
            Args: {
                user_id: string;
            };
            Returns: string;
        };
        get_user_main_org_id_by_app_id: {
            Args: {
                app_id: string;
            };
            Returns: string;
        };
        get_versions_with_no_metadata: {
            Args: never;
            Returns: {
                app_id: string;
                checksum: string | null;
                cli_version: string | null;
                comment: string | null;
                created_at: string | null;
                deleted: boolean;
                external_url: string | null;
                id: number;
                key_id: string | null;
                link: string | null;
                manifest: Database["public"]["CompositeTypes"]["manifest_entry"][] | null;
                manifest_count: number;
                min_update_version: string | null;
                name: string;
                native_packages: import("./types/supabase.types").Json[] | null;
                owner_org: string;
                r2_path: string | null;
                session_key: string | null;
                storage_provider: string;
                updated_at: string | null;
                user_id: string | null;
            }[];
            SetofOptions: {
                from: "*";
                to: "app_versions";
                isOneToOne: false;
                isSetofReturn: true;
            };
        };
        get_weekly_stats: {
            Args: {
                app_id: string;
            };
            Returns: {
                all_updates: number;
                failed_updates: number;
                open_app: number;
            }[];
        };
        has_2fa_enabled: {
            Args: never;
            Returns: boolean;
        } | {
            Args: {
                user_id: string;
            };
            Returns: boolean;
        };
        has_app_right: {
            Args: {
                appid: string;
                right: Database["public"]["Enums"]["user_min_right"];
            };
            Returns: boolean;
        };
        has_app_right_apikey: {
            Args: {
                apikey: string;
                appid: string;
                right: Database["public"]["Enums"]["user_min_right"];
                userid: string;
            };
            Returns: boolean;
        };
        has_app_right_userid: {
            Args: {
                appid: string;
                right: Database["public"]["Enums"]["user_min_right"];
                userid: string;
            };
            Returns: boolean;
        };
        invite_user_to_org: {
            Args: {
                email: string;
                invite_type: Database["public"]["Enums"]["user_min_right"];
                org_id: string;
            };
            Returns: string;
        };
        is_account_disabled: {
            Args: {
                user_id: string;
            };
            Returns: boolean;
        };
        is_admin: {
            Args: never;
            Returns: boolean;
        } | {
            Args: {
                userid: string;
            };
            Returns: boolean;
        };
        is_allowed_action: {
            Args: {
                apikey: string;
                appid: string;
            };
            Returns: boolean;
        };
        is_allowed_action_org: {
            Args: {
                orgid: string;
            };
            Returns: boolean;
        };
        is_allowed_action_org_action: {
            Args: {
                actions: Database["public"]["Enums"]["action_type"][];
                orgid: string;
            };
            Returns: boolean;
        };
        is_allowed_capgkey: {
            Args: {
                apikey: string;
                keymode: Database["public"]["Enums"]["key_mode"][];
            };
            Returns: boolean;
        } | {
            Args: {
                apikey: string;
                app_id: string;
                keymode: Database["public"]["Enums"]["key_mode"][];
            };
            Returns: boolean;
        };
        is_apikey_expired: {
            Args: {
                key_expires_at: string;
            };
            Returns: boolean;
        };
        is_app_owner: {
            Args: {
                apikey: string;
                appid: string;
            };
            Returns: boolean;
        } | {
            Args: {
                appid: string;
            };
            Returns: boolean;
        } | {
            Args: {
                appid: string;
                userid: string;
            };
            Returns: boolean;
        };
        is_bandwidth_exceeded_by_org: {
            Args: {
                org_id: string;
            };
            Returns: boolean;
        };
        is_build_time_exceeded_by_org: {
            Args: {
                org_id: string;
            };
            Returns: boolean;
        };
        is_canceled_org: {
            Args: {
                orgid: string;
            };
            Returns: boolean;
        };
        is_good_plan_v5_org: {
            Args: {
                orgid: string;
            };
            Returns: boolean;
        };
        is_mau_exceeded_by_org: {
            Args: {
                org_id: string;
            };
            Returns: boolean;
        };
        is_member_of_org: {
            Args: {
                org_id: string;
                user_id: string;
            };
            Returns: boolean;
        };
        is_not_deleted: {
            Args: {
                email_check: string;
            };
            Returns: boolean;
        };
        is_numeric: {
            Args: {
                "": string;
            };
            Returns: boolean;
        };
        is_onboarded_org: {
            Args: {
                orgid: string;
            };
            Returns: boolean;
        };
        is_onboarding_needed_org: {
            Args: {
                orgid: string;
            };
            Returns: boolean;
        };
        is_org_yearly: {
            Args: {
                orgid: string;
            };
            Returns: boolean;
        };
        is_paying_and_good_plan_org: {
            Args: {
                orgid: string;
            };
            Returns: boolean;
        };
        is_paying_and_good_plan_org_action: {
            Args: {
                actions: Database["public"]["Enums"]["action_type"][];
                orgid: string;
            };
            Returns: boolean;
        };
        is_paying_org: {
            Args: {
                orgid: string;
            };
            Returns: boolean;
        };
        is_storage_exceeded_by_org: {
            Args: {
                org_id: string;
            };
            Returns: boolean;
        };
        is_trial_org: {
            Args: {
                orgid: string;
            };
            Returns: number;
        };
        mass_edit_queue_messages_cf_ids: {
            Args: {
                updates: Database["public"]["CompositeTypes"]["message_update"][];
            };
            Returns: undefined;
        };
        modify_permissions_tmp: {
            Args: {
                email: string;
                new_role: Database["public"]["Enums"]["user_min_right"];
                org_id: string;
            };
            Returns: string;
        };
        one_month_ahead: {
            Args: never;
            Returns: string;
        };
        parse_cron_field: {
            Args: {
                current_val: number;
                field: string;
                max_val: number;
            };
            Returns: number;
        };
        parse_step_pattern: {
            Args: {
                pattern: string;
            };
            Returns: number;
        };
        pg_log: {
            Args: {
                decision: string;
                input?: import("./types/supabase.types").Json;
            };
            Returns: undefined;
        };
        process_admin_stats: {
            Args: never;
            Returns: undefined;
        };
        process_all_cron_tasks: {
            Args: never;
            Returns: undefined;
        };
        process_billing_period_stats_email: {
            Args: never;
            Returns: undefined;
        };
        process_channel_device_counts_queue: {
            Args: {
                batch_size?: number;
            };
            Returns: number;
        };
        process_cron_stats_jobs: {
            Args: never;
            Returns: undefined;
        };
        process_cron_sync_sub_jobs: {
            Args: never;
            Returns: undefined;
        };
        process_deploy_install_stats_email: {
            Args: never;
            Returns: undefined;
        };
        process_failed_uploads: {
            Args: never;
            Returns: undefined;
        };
        process_free_trial_expired: {
            Args: never;
            Returns: undefined;
        };
        process_function_queue: {
            Args: {
                batch_size?: number;
                queue_name: string;
            };
            Returns: undefined;
        } | {
            Args: {
                batch_size?: number;
                queue_names: string[];
            };
            Returns: undefined;
        };
        process_stats_email_monthly: {
            Args: never;
            Returns: undefined;
        };
        process_stats_email_weekly: {
            Args: never;
            Returns: undefined;
        };
        process_subscribed_orgs: {
            Args: never;
            Returns: undefined;
        };
        queue_cron_stat_org_for_org: {
            Args: {
                customer_id: string;
                org_id: string;
            };
            Returns: undefined;
        };
        read_bandwidth_usage: {
            Args: {
                p_app_id: string;
                p_period_end: string;
                p_period_start: string;
            };
            Returns: {
                app_id: string;
                bandwidth: number;
                date: string;
            }[];
        };
        read_device_usage: {
            Args: {
                p_app_id: string;
                p_period_end: string;
                p_period_start: string;
            };
            Returns: {
                app_id: string;
                date: string;
                mau: number;
            }[];
        };
        read_storage_usage: {
            Args: {
                p_app_id: string;
                p_period_end: string;
                p_period_start: string;
            };
            Returns: {
                app_id: string;
                date: string;
                storage: number;
            }[];
        };
        read_version_usage: {
            Args: {
                p_app_id: string;
                p_period_end: string;
                p_period_start: string;
            };
            Returns: {
                app_id: string;
                date: string;
                fail: number;
                get: number;
                install: number;
                uninstall: number;
                version_id: number;
            }[];
        };
        record_build_time: {
            Args: {
                p_build_id: string;
                p_build_time_unit: number;
                p_org_id: string;
                p_platform: string;
                p_user_id: string;
            };
            Returns: string;
        };
        reject_access_due_to_2fa: {
            Args: {
                org_id: string;
                user_id: string;
            };
            Returns: boolean;
        };
        reject_access_due_to_2fa_for_app: {
            Args: {
                app_id: string;
            };
            Returns: boolean;
        };
        reject_access_due_to_2fa_for_org: {
            Args: {
                org_id: string;
            };
            Returns: boolean;
        };
        reject_access_due_to_password_policy: {
            Args: {
                org_id: string;
                user_id: string;
            };
            Returns: boolean;
        };
        remove_old_jobs: {
            Args: never;
            Returns: undefined;
        };
        rescind_invitation: {
            Args: {
                email: string;
                org_id: string;
            };
            Returns: string;
        };
        seed_get_app_metrics_caches: {
            Args: {
                p_end_date: string;
                p_org_id: string;
                p_start_date: string;
            };
            Returns: {
                cached_at: string;
                end_date: string;
                id: number;
                org_id: string;
                response: import("./types/supabase.types").Json;
                start_date: string;
            };
            SetofOptions: {
                from: "*";
                to: "app_metrics_cache";
                isOneToOne: true;
                isSetofReturn: false;
            };
        };
        set_bandwidth_exceeded_by_org: {
            Args: {
                disabled: boolean;
                org_id: string;
            };
            Returns: undefined;
        };
        set_build_time_exceeded_by_org: {
            Args: {
                disabled: boolean;
                org_id: string;
            };
            Returns: undefined;
        };
        set_mau_exceeded_by_org: {
            Args: {
                disabled: boolean;
                org_id: string;
            };
            Returns: undefined;
        };
        set_storage_exceeded_by_org: {
            Args: {
                disabled: boolean;
                org_id: string;
            };
            Returns: undefined;
        };
        top_up_usage_credits: {
            Args: {
                p_amount: number;
                p_expires_at?: string;
                p_notes?: string;
                p_org_id: string;
                p_source?: string;
                p_source_ref?: import("./types/supabase.types").Json;
            };
            Returns: {
                available_credits: number;
                grant_id: string;
                next_expiration: string;
                total_credits: number;
                transaction_id: number;
            }[];
        };
        total_bundle_storage_bytes: {
            Args: never;
            Returns: number;
        };
        transfer_app: {
            Args: {
                p_app_id: string;
                p_new_org_id: string;
            };
            Returns: undefined;
        };
        transform_role_to_invite: {
            Args: {
                role_input: Database["public"]["Enums"]["user_min_right"];
            };
            Returns: Database["public"]["Enums"]["user_min_right"];
        };
        transform_role_to_non_invite: {
            Args: {
                role_input: Database["public"]["Enums"]["user_min_right"];
            };
            Returns: Database["public"]["Enums"]["user_min_right"];
        };
        update_app_versions_retention: {
            Args: never;
            Returns: undefined;
        };
        upsert_version_meta: {
            Args: {
                p_app_id: string;
                p_size: number;
                p_version_id: number;
            };
            Returns: boolean;
        };
        user_meets_password_policy: {
            Args: {
                org_id: string;
                user_id: string;
            };
            Returns: boolean;
        };
        verify_api_key_hash: {
            Args: {
                plain_key: string;
                stored_hash: string;
            };
            Returns: boolean;
        };
        verify_mfa: {
            Args: never;
            Returns: boolean;
        };
    };
    Enums: {
        action_type: "mau" | "storage" | "bandwidth" | "build_time";
        credit_metric_type: "mau" | "bandwidth" | "storage" | "build_time";
        credit_transaction_type: "grant" | "purchase" | "manual_grant" | "deduction" | "expiry" | "refund";
        cron_task_type: "function" | "queue" | "function_queue";
        disable_update: "major" | "minor" | "patch" | "version_number" | "none";
        key_mode: "read" | "write" | "all" | "upload";
        platform_os: "ios" | "android";
        stats_action: "delete" | "reset" | "set" | "get" | "set_fail" | "update_fail" | "download_fail" | "windows_path_fail" | "canonical_path_fail" | "directory_path_fail" | "unzip_fail" | "low_mem_fail" | "download_10" | "download_20" | "download_30" | "download_40" | "download_50" | "download_60" | "download_70" | "download_80" | "download_90" | "download_complete" | "decrypt_fail" | "app_moved_to_foreground" | "app_moved_to_background" | "uninstall" | "needPlanUpgrade" | "missingBundle" | "noNew" | "disablePlatformIos" | "disablePlatformAndroid" | "disableAutoUpdateToMajor" | "cannotUpdateViaPrivateChannel" | "disableAutoUpdateToMinor" | "disableAutoUpdateToPatch" | "channelMisconfigured" | "disableAutoUpdateMetadata" | "disableAutoUpdateUnderNative" | "disableDevBuild" | "disableEmulator" | "cannotGetBundle" | "checksum_fail" | "NoChannelOrOverride" | "setChannel" | "getChannel" | "rateLimited" | "disableAutoUpdate" | "keyMismatch" | "ping" | "InvalidIp" | "blocked_by_server_url" | "download_manifest_start" | "download_manifest_complete" | "download_zip_start" | "download_zip_complete" | "download_manifest_file_fail" | "download_manifest_checksum_fail" | "download_manifest_brotli_fail" | "backend_refusal" | "download_0" | "disableProdBuild" | "disableDevice";
        stripe_status: "created" | "succeeded" | "updated" | "failed" | "deleted" | "canceled";
        user_min_right: "invite_read" | "invite_upload" | "invite_write" | "invite_admin" | "invite_super_admin" | "read" | "upload" | "write" | "admin" | "super_admin";
        user_role: "read" | "upload" | "write" | "admin";
        version_action: "get" | "fail" | "install" | "uninstall";
    };
    CompositeTypes: {
        manifest_entry: {
            file_name: string | null;
            s3_path: string | null;
            file_hash: string | null;
        };
        message_update: {
            msg_id: number | null;
            cf_id: string | null;
            queue: string | null;
        };
        orgs_table: {
            id: string | null;
            created_by: string | null;
            created_at: string | null;
            updated_at: string | null;
            logo: string | null;
            name: string | null;
        };
        owned_orgs: {
            id: string | null;
            created_by: string | null;
            logo: string | null;
            name: string | null;
            role: string | null;
        };
        stats_table: {
            mau: number | null;
            bandwidth: number | null;
            storage: number | null;
        };
    };
}, {
    PostgrestVersion: "14.1";
}>>;
export declare function checkKey(supabase: SupabaseClient<Database>, apikey: string, keymode: Database['public']['Enums']['key_mode'][]): Promise<void>;
export declare function isPayingOrg(supabase: SupabaseClient<Database>, orgId: string): Promise<boolean>;
export declare function isTrialOrg(supabase: SupabaseClient<Database>, orgId: string): Promise<number>;
export declare function isAllowedActionOrg(supabase: SupabaseClient<Database>, orgId: string): Promise<boolean>;
export declare function isAllowedActionAppIdApiKey(supabase: SupabaseClient<Database>, appId: string, apikey: string): Promise<boolean>;
export declare function isAllowedApp(supabase: SupabaseClient<Database>, apikey: string, appId: string): Promise<boolean>;
export declare enum OrganizationPerm {
    none = 0,
    read = 1,
    upload = 2,
    write = 3,
    admin = 4,
    super_admin = 5
}
export declare const hasOrganizationPerm: (perm: OrganizationPerm, required: OrganizationPerm) => boolean;
export declare function isAllowedAppOrg(supabase: SupabaseClient<Database>, apikey: string, appId: string): Promise<{
    okay: true;
    data: OrganizationPerm;
} | {
    okay: false;
    error: 'INVALID_APIKEY' | 'NO_APP' | 'NO_ORG';
}>;
export declare function checkRemoteCliMessages(supabase: SupabaseClient<Database>, orgId: string, cliVersion: string): Promise<void>;
export declare function checkPlanValid(supabase: SupabaseClient<Database>, orgId: string, apikey: string, appId?: string, warning?: boolean): Promise<void>;
export declare function checkPlanValidUpload(supabase: SupabaseClient<Database>, orgId: string, apikey: string, appId?: string, warning?: boolean): Promise<void>;
export declare function findSavedKey(quiet?: boolean): string;
export declare function getContentType(filename: string): string;
export declare function findProjectType(options?: {
    quiet?: boolean;
}): Promise<"unknown" | "angular-ts" | "angular-js" | "nuxtjs-ts" | "nuxtjs-js" | "nextjs-ts" | "nextjs-js" | "sveltekit-ts" | "sveltekit-js" | "svelte-ts" | "svelte-js" | "vue-ts" | "vue-js" | "react-ts" | "react-js">;
export declare function findMainFileForProjectType(projectType: string, isTypeScript: boolean): string | null;
export declare function findBuildCommandForProjectType(projectType: string): Promise<"build" | "generate">;
export declare function findMainFile(): Promise<string>;
export declare function updateOrCreateVersion(supabase: SupabaseClient<Database>, update: Database['public']['Tables']['app_versions']['Insert']): Promise<import("@supabase/postgrest-js").PostgrestSingleResponse<null>>;
export declare function uploadUrl(supabase: SupabaseClient<Database>, appId: string, name: string): Promise<string>;
export declare const BROTLI_MIN_UPDATER_VERSION_V5 = "5.10.0";
export declare const BROTLI_MIN_UPDATER_VERSION_V6 = "6.25.0";
export declare const BROTLI_MIN_UPDATER_VERSION_V7 = "7.0.30";
export declare function isDeprecatedPluginVersion(parsedPluginVersion: SemVer, minFive?: string, minSix?: string, minSeven?: string): boolean;
export declare function generateManifest(path: string): Promise<{
    file: string;
    hash: string;
}[]>;
export type manifestType = Awaited<ReturnType<typeof generateManifest>>;
export type { uploadUrlsType } from './schemas/common';
export declare function zipFile(filePath: string): Promise<Buffer>;
export declare function zipFileUnix(filePath: string): Buffer<ArrayBufferLike>;
export declare function zipFileWindows(filePath: string): Promise<Buffer>;
export declare function uploadTUS(apikey: string, data: Buffer, orgId: string, appId: string, name: string, spinner: ReturnType<typeof spinnerC>, localConfig: CapgoConfig, chunkSize: number): Promise<boolean>;
export declare function deletedFailedVersion(supabase: SupabaseClient<Database>, appId: string, name: string): Promise<void>;
export declare function updateOrCreateChannel(supabase: SupabaseClient<Database>, update: Database['public']['Tables']['channels']['Insert']): Promise<import("@supabase/postgrest-js").PostgrestSingleResponse<{
    allow_dev: boolean;
    allow_device: boolean;
    allow_device_self_set: boolean;
    allow_emulator: boolean;
    allow_prod: boolean;
    android: boolean;
    app_id: string;
    created_at: string;
    created_by: string;
    disable_auto_update: Database["public"]["Enums"]["disable_update"];
    disable_auto_update_under_native: boolean;
    id: number;
    ios: boolean;
    name: string;
    owner_org: string;
    public: boolean;
    updated_at: string;
    version: number;
}>>;
export declare function sendEvent(capgkey: string, payload: TrackOptions & {
    notifyConsole?: boolean;
}, verbose?: boolean): Promise<void>;
export declare function show2FADeniedError(organizationName?: string): never;
export declare function getOrganization(supabase: SupabaseClient<Database>, roles: string[]): Promise<Organization>;
export declare function verifyUser(supabase: SupabaseClient<Database>, apikey: string, keymod?: Database['public']['Enums']['key_mode'][]): Promise<string>;
export declare function getOrganizationId(supabase: SupabaseClient<Database>, appId: string): Promise<string>;
export declare function requireUpdateMetadata(supabase: SupabaseClient<Database>, channel: string, appId: string): Promise<boolean>;
export declare function getHumanDate(createdA: string | null): string;
export declare function getPMAndCommand(): {
    pm: PackageManagerType;
    command: InstallCommand;
    installCommand: string;
    runner: PackageManagerRunner;
};
export declare function getNativeProjectResetAdvice(platformRunner: string, nativePlatform: 'ios' | 'android'): {
    summary: string;
    command: string;
};
export declare function getLocalDependencies(packageJsonPath: string | undefined, nodeModulesString: string | undefined): Promise<{
    name: string;
    version: string;
    native: boolean;
    ios_checksum?: string;
    android_checksum?: string;
}[]>;
export declare function getRemoteChecksums(supabase: SupabaseClient<Database>, appId: string, channel: string): Promise<string | null>;
export type { NativePackage } from './schemas/common';
export declare function convertNativePackages(nativePackages: NativePackage[]): Map<string, NativePackage>;
export declare function getRemoteDependencies(supabase: SupabaseClient<Database>, appId: string, channel: string): Promise<Map<string, {
    name: string;
    version: string;
    ios_checksum?: string | undefined;
    android_checksum?: string | undefined;
}>>;
export declare function checkChecksum(supabase: SupabaseClient<Database>, appId: string, channel: string, currentChecksum: string): Promise<void>;
export type { Compatibility, CompatibilityDetails, IncompatibilityReason } from './schemas/common';
export declare function getAppId(appId: string | undefined, config: CapacitorConfig | undefined): any;
/**
 * Check if a package is compatible and return detailed reasons if not
 */
export declare function getCompatibilityDetails(pkg: Compatibility): CompatibilityDetails;
/**
 * Simple compatibility check (backward compatible)
 */
export declare function isCompatible(pkg: Compatibility): boolean;
export declare function checkCompatibilityCloud(supabase: SupabaseClient<Database>, appId: string, channel: string, packageJsonPath: string | undefined, nodeModules: string | undefined): Promise<{
    finalCompatibility: {
        name: string;
        localVersion?: string | undefined;
        remoteVersion?: string | undefined;
        localIosChecksum?: string | undefined;
        remoteIosChecksum?: string | undefined;
        localAndroidChecksum?: string | undefined;
        remoteAndroidChecksum?: string | undefined;
    }[];
    localDependencies: {
        name: string;
        version: string;
        native: boolean;
        ios_checksum?: string;
        android_checksum?: string;
    }[];
}>;
export declare function checkCompatibilityNativePackages(supabase: SupabaseClient<Database>, appId: string, channel: string, nativePackages: NativePackage[]): Promise<{
    finalCompatibility: {
        name: string;
        localVersion?: string | undefined;
        remoteVersion?: string | undefined;
        localIosChecksum?: string | undefined;
        remoteIosChecksum?: string | undefined;
        localAndroidChecksum?: string | undefined;
        remoteAndroidChecksum?: string | undefined;
    }[];
    localDependencies: {
        name: string;
        version: string;
        ios_checksum?: string | undefined;
        android_checksum?: string | undefined;
    }[];
}>;
export interface IosUpdaterSyncValidationResult {
    shouldCheck: boolean;
    valid: boolean;
    details: string[];
}
/**
 * Validate whether the iOS native project is correctly synced for capacitor-updater.
 *
 * `shouldCheck` is `false` when no iOS project is present or no updater signals are detected
 * (no dependency declaration, installed package, or native references). `shouldCheck` is `true`
 * as soon as any signal indicates updater should be wired, then both dependency definitions
 * (`Podfile` or SPM `Package.swift`) and generated native outputs (`Podfile.lock`,
 * `capacitor.plugins.json`, or `ios/App/App/capacitor.config.json`) must include
 * updater markers for `valid` to be `true`.
 */
export declare function validateIosUpdaterSync(rootDir?: string, packageJsonPath?: string): IosUpdaterSyncValidationResult;
interface PromptAndSyncOptions {
    validateIosUpdater?: boolean;
    packageJsonPath?: string;
}
export declare function promptAndSyncCapacitor(isInit?: boolean, orgId?: string, apikey?: string, options?: PromptAndSyncOptions): Promise<void>;
