import { MastraCompositeStore } from '@mastra/core/storage';
import type { StorageDomains, CreateIndexOptions } from '@mastra/core/storage';
import sql from 'mssql';
import { AgentsMSSQL } from './domains/agents/index.js';
import { BackgroundTasksMSSQL } from './domains/background-tasks/index.js';
import { MemoryMSSQL } from './domains/memory/index.js';
import { ObservabilityMSSQL } from './domains/observability/index.js';
import { ScoresMSSQL } from './domains/scores/index.js';
import { WorkflowsMSSQL } from './domains/workflows/index.js';
export { AgentsMSSQL, BackgroundTasksMSSQL, MemoryMSSQL, ObservabilityMSSQL, ScoresMSSQL, WorkflowsMSSQL };
export type { MssqlDomainConfig } from './db/index.js';
/**
 * MSSQL configuration type.
 *
 * Accepts either:
 * - A pre-configured connection pool: `{ id, pool, schemaName? }`
 * - Connection string: `{ id, connectionString, ... }`
 * - Server/port config: `{ id, server, port, database, user, password, ... }`
 */
export type MSSQLConfigType = {
    id: string;
    schemaName?: string;
    /**
     * When true, automatic initialization (table creation/migrations) is disabled.
     * This is useful for CI/CD pipelines where you want to:
     * 1. Run migrations explicitly during deployment (not at runtime)
     * 2. Use different credentials for schema changes vs runtime operations
     *
     * When disableInit is true:
     * - The storage will not automatically create/alter tables on first use
     * - You must call `storage.init()` explicitly in your CI/CD scripts
     *
     * @example
     * // In CI/CD script:
     * const storage = new MSSQLStore({ ...config, disableInit: false });
     * await storage.init(); // Explicitly run migrations
     *
     * // In runtime application:
     * const storage = new MSSQLStore({ ...config, disableInit: true });
     * // No auto-init, tables must already exist
     */
    disableInit?: boolean;
    /**
     * When true, default indexes will not be created during initialization.
     * This is useful when:
     * 1. You want to manage indexes separately or use custom indexes only
     * 2. Default indexes don't match your query patterns
     * 3. You want to reduce initialization time in development
     *
     * @default false
     */
    skipDefaultIndexes?: boolean;
    /**
     * Custom indexes to create during initialization.
     * These indexes are created in addition to default indexes (unless skipDefaultIndexes is true).
     *
     * Each index must specify which table it belongs to. The store will route each index
     * to the appropriate domain based on the table name.
     *
     * @example
     * ```typescript
     * const store = new MSSQLStore({
     *   connectionString: '...',
     *   indexes: [
     *     { name: 'my_threads_type_idx', table: 'mastra_threads', columns: ['JSON_VALUE(metadata, \'$.type\')'] },
     *   ],
     * });
     * ```
     */
    indexes?: CreateIndexOptions[];
} & ({
    /**
     * Pre-configured mssql ConnectionPool.
     * Use this when you need to configure the pool before initialization,
     * e.g., to add pool listeners or set connection-level settings.
     *
     * @example
     * ```typescript
     * import sql from 'mssql';
     *
     * const pool = new sql.ConnectionPool({
     *   server: 'localhost',
     *   database: 'mydb',
     *   user: 'user',
     *   password: 'password',
     * });
     *
     * // Custom setup before using
     * pool.on('connect', () => {
     *   console.log('Pool connected');
     * });
     *
     * const store = new MSSQLStore({ id: 'my-store', pool });
     * ```
     */
    pool: sql.ConnectionPool;
} | {
    server: string;
    port: number;
    database: string;
    user: string;
    password: string;
    options?: sql.IOptions;
} | {
    connectionString: string;
});
export type MSSQLConfig = MSSQLConfigType;
/**
 * MSSQL storage adapter for Mastra.
 *
 * Access domain-specific storage via `getStore()`:
 *
 * @example
 * ```typescript
 * const storage = new MSSQLStore({ id: 'my-store', connectionString: '...' });
 *
 * // Access memory domain
 * const memory = await storage.getStore('memory');
 * await memory?.saveThread({ thread });
 *
 * // Access workflows domain
 * const workflows = await storage.getStore('workflows');
 * await workflows?.persistWorkflowSnapshot({ workflowName, runId, snapshot });
 *
 * // Access observability domain
 * const observability = await storage.getStore('observability');
 * await observability?.createSpan(span);
 * ```
 */
export declare class MSSQLStore extends MastraCompositeStore {
    pool: sql.ConnectionPool;
    private schema?;
    private isConnected;
    stores: StorageDomains;
    constructor(config: MSSQLConfigType);
    init(): Promise<void>;
    private _performInitializationAndStore;
    /**
     * Closes the MSSQL connection pool.
     *
     * This will close the connection pool, including pre-configured pools.
     */
    close(): Promise<void>;
}
//# sourceMappingURL=index.d.ts.map