import { FetchAdapter } from '../adapter.ts';
import { z } from 'zod';
/**
 * Minimum TTL value in seconds (1 minute)
 */
export declare const VECTOR_MIN_TTL_SECONDS = 60;
/**
 * Maximum TTL value in seconds (90 days)
 */
export declare const VECTOR_MAX_TTL_SECONDS = 7776000;
/**
 * Default TTL value in seconds (30 days) - used when no TTL is specified
 */
export declare const VECTOR_DEFAULT_TTL_SECONDS = 2592000;
/**
 * Base properties shared by all vector upsert operations
 */
export declare const VectorUpsertBaseSchema: z.ZodObject<{
    key: z.ZodString;
    metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
    ttl: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
}, z.core.$strip>;
export type VectorUpsertBase = z.infer<typeof VectorUpsertBaseSchema>;
/**
 * Upsert using pre-computed embeddings
 */
export declare const VectorUpsertEmbeddingsSchema: z.ZodObject<{
    key: z.ZodString;
    metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
    ttl: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
    embeddings: z.ZodArray<z.ZodNumber>;
    document: z.ZodOptional<z.ZodNever>;
}, z.core.$strip>;
export type VectorUpsertEmbeddings = z.infer<typeof VectorUpsertEmbeddingsSchema>;
/**
 * Upsert using text that will be converted to embeddings
 */
export declare const VectorUpsertTextSchema: z.ZodObject<{
    key: z.ZodString;
    metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
    ttl: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
    document: z.ZodString;
    embeddings: z.ZodOptional<z.ZodNever>;
}, z.core.$strip>;
export type VectorUpsertText = z.infer<typeof VectorUpsertTextSchema>;
/**
 * Parameters for upserting a vector
 */
export type VectorUpsertParams = VectorUpsertEmbeddings | VectorUpsertText;
export declare const VectorUpsertParamsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
    key: z.ZodString;
    metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
    ttl: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
    document: z.ZodString;
    embeddings: z.ZodOptional<z.ZodNever>;
}, z.core.$strip>, z.ZodObject<{
    key: z.ZodString;
    metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
    ttl: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
    embeddings: z.ZodArray<z.ZodNumber>;
    document: z.ZodOptional<z.ZodUndefined>;
}, z.core.$strip>], "document">;
/**
 * Parameters for searching vectors
 */
export declare const VectorSearchParamsSchema: <T extends z.ZodTypeAny>(metadataSchema: T) => z.ZodObject<{
    query: z.ZodString;
    limit: z.ZodOptional<z.ZodNumber>;
    similarity: z.ZodOptional<z.ZodNumber>;
    metadata: z.ZodOptional<T>;
}, z.core.$strip>;
export type VectorSearchParams<T extends Record<string, unknown> = Record<string, unknown>> = {
    query: string;
    limit?: number;
    similarity?: number;
    metadata?: T;
};
/**
 * Result of a vector search operation with optional type-safe metadata
 */
export declare const VectorSearchResultSchema: <T extends z.ZodTypeAny>(metadataSchema: T) => z.ZodObject<{
    id: z.ZodString;
    key: z.ZodString;
    metadata: z.ZodOptional<T>;
    similarity: z.ZodNumber;
    expiresAt: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
export type VectorSearchResult<T extends Record<string, unknown> = Record<string, unknown>> = {
    id: string;
    key: string;
    metadata?: T;
    similarity: number;
    expiresAt?: string;
};
/**
 * Extended search result that includes the document and embeddings
 */
export declare const VectorSearchResultWithDocumentSchema: <T extends z.ZodTypeAny>(metadataSchema: T) => z.ZodObject<{
    id: z.ZodString;
    key: z.ZodString;
    metadata: z.ZodOptional<T>;
    similarity: z.ZodNumber;
    expiresAt: z.ZodOptional<z.ZodString>;
    document: z.ZodOptional<z.ZodString>;
    embeddings: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
}, z.core.$strip>;
export type VectorSearchResultWithDocument<T extends Record<string, unknown> = Record<string, unknown>> = VectorSearchResult<T> & {
    document?: string;
    embeddings?: Array<number>;
};
/**
 * Result of a vector upsert operation
 */
export declare const VectorUpsertResultSchema: z.ZodObject<{
    key: z.ZodString;
    id: z.ZodString;
}, z.core.$strip>;
export type VectorUpsertResult = z.infer<typeof VectorUpsertResultSchema>;
/**
 * Result when a vector is found by key
 */
export declare const VectorResultFoundSchema: <T extends z.ZodTypeAny>(metadataSchema: T) => z.ZodObject<{
    data: z.ZodObject<{
        id: z.ZodString;
        key: z.ZodString;
        metadata: z.ZodOptional<T>;
        similarity: z.ZodNumber;
        expiresAt: z.ZodOptional<z.ZodString>;
        document: z.ZodOptional<z.ZodString>;
        embeddings: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
    }, z.core.$strip>;
    exists: z.ZodLiteral<true>;
}, z.core.$strip>;
export type VectorResultFound<T extends Record<string, unknown> = Record<string, unknown>> = {
    data: VectorSearchResultWithDocument<T>;
    exists: true;
};
/**
 * Result when a vector is not found by key
 */
export declare const VectorResultNotFoundSchema: z.ZodObject<{
    data: z.ZodNever;
    exists: z.ZodLiteral<false>;
}, z.core.$strip>;
export type VectorResultNotFound = z.infer<typeof VectorResultNotFoundSchema>;
/**
 * Result of a get operation
 */
export type VectorResult<T extends Record<string, unknown> = Record<string, unknown>> = VectorResultFound<T> | VectorResultNotFound;
export declare const VectorResultSchema: <T extends z.ZodTypeAny>(metadataSchema: T) => z.ZodDiscriminatedUnion<[z.ZodObject<{
    data: z.ZodObject<{
        id: z.ZodString;
        key: z.ZodString;
        metadata: z.ZodOptional<T>;
        similarity: z.ZodNumber;
        expiresAt: z.ZodOptional<z.ZodString>;
        document: z.ZodOptional<z.ZodString>;
        embeddings: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
    }, z.core.$strip>;
    exists: z.ZodLiteral<true>;
}, z.core.$strip>, z.ZodObject<{
    data: z.ZodNever;
    exists: z.ZodLiteral<false>;
}, z.core.$strip>], "exists">;
/**
 * Statistics for a vector namespace
 */
export declare const VectorNamespaceStatsSchema: z.ZodObject<{
    sum: z.ZodNumber;
    count: z.ZodNumber;
    createdAt: z.ZodOptional<z.ZodNumber>;
    lastUsed: z.ZodOptional<z.ZodNumber>;
    internal: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>;
export type VectorNamespaceStats = z.infer<typeof VectorNamespaceStatsSchema>;
/**
 * Statistics for an individual vector item
 */
export declare const VectorItemStatsSchema: z.ZodObject<{
    embedding: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
    document: z.ZodOptional<z.ZodString>;
    size: z.ZodNumber;
    metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
    firstUsed: z.ZodNumber;
    lastUsed: z.ZodNumber;
    count: z.ZodOptional<z.ZodNumber>;
    expiresAt: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
export type VectorItemStats = z.infer<typeof VectorItemStatsSchema>;
/**
 * Namespace statistics with sampled vector results
 */
export declare const VectorNamespaceStatsWithSamplesSchema: z.ZodObject<{
    sum: z.ZodNumber;
    count: z.ZodNumber;
    createdAt: z.ZodOptional<z.ZodNumber>;
    lastUsed: z.ZodOptional<z.ZodNumber>;
    internal: z.ZodOptional<z.ZodBoolean>;
    sampledResults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
        embedding: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
        document: z.ZodOptional<z.ZodString>;
        size: z.ZodNumber;
        metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
        firstUsed: z.ZodNumber;
        lastUsed: z.ZodNumber;
        count: z.ZodOptional<z.ZodNumber>;
        expiresAt: z.ZodOptional<z.ZodString>;
    }, z.core.$strip>>>;
}, z.core.$strip>;
export type VectorNamespaceStatsWithSamples = z.infer<typeof VectorNamespaceStatsWithSamplesSchema>;
export declare const VectorSortFieldSchema: z.ZodEnum<{
    name: "name";
    created: "created";
    size: "size";
    records: "records";
    lastUsed: "lastUsed";
}>;
export type VectorSortField = z.infer<typeof VectorSortFieldSchema>;
/**
 * Parameters for getting all namespace statistics with optional pagination
 */
export declare const VectorGetAllStatsParamsSchema: z.ZodObject<{
    limit: z.ZodOptional<z.ZodNumber>;
    offset: z.ZodOptional<z.ZodNumber>;
    sort: z.ZodOptional<z.ZodEnum<{
        name: "name";
        created: "created";
        size: "size";
        records: "records";
        lastUsed: "lastUsed";
    }>>;
    direction: z.ZodOptional<z.ZodEnum<{
        asc: "asc";
        desc: "desc";
    }>>;
    name: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
export type VectorGetAllStatsParams = z.infer<typeof VectorGetAllStatsParamsSchema>;
/**
 * Paginated response for vector namespace statistics
 */
export declare const VectorStatsPaginatedSchema: z.ZodObject<{
    namespaces: z.ZodRecord<z.ZodString, z.ZodObject<{
        sum: z.ZodNumber;
        count: z.ZodNumber;
        createdAt: z.ZodOptional<z.ZodNumber>;
        lastUsed: z.ZodOptional<z.ZodNumber>;
        internal: z.ZodOptional<z.ZodBoolean>;
    }, z.core.$strip>>;
    total: z.ZodNumber;
    limit: z.ZodNumber;
    offset: z.ZodNumber;
    hasMore: z.ZodBoolean;
}, z.core.$strip>;
export type VectorStatsPaginated = z.infer<typeof VectorStatsPaginatedSchema>;
/**
 * Vector storage service for managing vector embeddings and semantic search
 */
export interface VectorStorage {
    /**
     * Upsert vectors into the vector storage. You can provide either pre-computed embeddings
     * or text documents that will be automatically embedded.
     *
     * @param name - the name of the vector storage namespace
     * @param documents - one or more documents to upsert
     * @returns array of results with key-to-id mappings for the upserted vectors
     *
     * @example
     * ```typescript
     * // Upsert with automatic embedding
     * const results = await vectorStore.upsert('products',
     *   {
     *     key: 'chair-001',
     *     document: 'Comfortable office chair with lumbar support',
     *     metadata: { category: 'furniture', price: 299 }
     *   },
     *   {
     *     key: 'desk-001',
     *     document: 'Standing desk with adjustable height',
     *     metadata: { category: 'furniture', price: 599 }
     *   }
     * );
     *
     * // Upsert with pre-computed embeddings
     * await vectorStore.upsert('products', {
     *   key: 'lamp-001',
     *   embeddings: [0.1, 0.2, 0.3, ...], // Your pre-computed vector
     *   metadata: { category: 'lighting', price: 49 }
     * });
     * ```
     */
    upsert(name: string, ...documents: VectorUpsertParams[]): Promise<VectorUpsertResult[]>;
    /**
     * Get a single vector by its key
     *
     * @param name - the name of the vector storage namespace
     * @param key - the key of the vector to retrieve
     * @returns VectorResult with exists field for type-safe checking
     *
     * @example
     * ```typescript
     * const result = await vectorStore.get('products', 'chair-001');
     * if (result.exists) {
     *   console.log('Found:', result.data.metadata);
     *   console.log('Embeddings:', result.data.embeddings);
     * }
     * ```
     */
    get<T extends Record<string, unknown> = Record<string, unknown>>(name: string, key: string): Promise<VectorResult<T>>;
    /**
     * Get multiple vectors by their keys in a single request
     *
     * @param name - the name of the vector storage namespace
     * @param keys - the keys of the vectors to retrieve
     * @returns a Map of key to vector data (only includes found vectors)
     *
     * @example
     * ```typescript
     * const vectors = await vectorStore.getMany('products', 'chair-001', 'desk-001', 'lamp-001');
     * for (const [key, data] of vectors) {
     *   console.log(`${key}:`, data.metadata);
     * }
     * ```
     */
    getMany<T extends Record<string, unknown> = Record<string, unknown>>(name: string, ...keys: string[]): Promise<Map<string, VectorSearchResultWithDocument<T>>>;
    /**
     * Search for semantically similar vectors using natural language queries
     *
     * @param name - the name of the vector storage namespace
     * @param params - search parameters including query, filters, and limits
     * @returns array of search results ordered by similarity (highest first)
     *
     * @example
     * ```typescript
     * // Basic semantic search
     * const results = await vectorStore.search('products', {
     *   query: 'comfortable seating for office',
     *   limit: 5
     * });
     *
     * // Search with metadata filters and similarity threshold
     * const filteredResults = await vectorStore.search('products', {
     *   query: 'ergonomic furniture',
     *   limit: 10,
     *   similarity: 0.7, // Only results with 70%+ similarity
     *   metadata: { category: 'furniture', inStock: true }
     * });
     *
     * for (const result of filteredResults) {
     *   console.log(`${result.key}: ${result.similarity * 100}% match`);
     *   console.log('Metadata:', result.metadata);
     * }
     * ```
     */
    search<T extends Record<string, unknown> = Record<string, unknown>>(name: string, params: VectorSearchParams<T>): Promise<VectorSearchResult<T>[]>;
    /**
     * Delete one or more vectors by their keys
     *
     * @param name - the name of the vector storage namespace
     * @param keys - one or more keys of vectors to delete
     * @returns the number of vectors that were deleted
     *
     * @example
     * ```typescript
     * // Delete a single vector
     * const deleted = await vectorStore.delete('products', 'chair-001');
     * console.log(`Deleted ${deleted} vector(s)`);
     *
     * // Delete multiple vectors
     * await vectorStore.delete('products', 'chair-001', 'desk-001', 'lamp-001');
     * ```
     */
    delete(name: string, ...keys: string[]): Promise<number>;
    /**
     * Check if a vector storage namespace exists
     *
     * @param name - the name of the vector storage namespace
     * @returns true if the namespace exists, false otherwise
     *
     * @example
     * ```typescript
     * if (await vectorStore.exists('products')) {
     *   console.log('Products namespace exists');
     * }
     * ```
     */
    exists(name: string): Promise<boolean>;
    /**
     * Get statistics for a specific namespace including sampled results
     *
     * @param name - the name of the vector storage namespace
     * @returns statistics for the namespace with sampled vector results
     *
     * @example
     * ```typescript
     * const stats = await vectorStore.getStats('products');
     * console.log(`Namespace has ${stats.count} vectors (${stats.sum} bytes)`);
     * if (stats.sampledResults) {
     *   for (const [key, item] of Object.entries(stats.sampledResults)) {
     *     console.log(`${key}: ${item.size} bytes, accessed ${item.count} times`);
     *   }
     * }
     * ```
     */
    getStats(name: string): Promise<VectorNamespaceStatsWithSamples>;
    /**
     * get statistics for all namespaces with optional pagination
     *
     * @param params - optional pagination parameters (limit, offset)
     * @returns map of namespace names to statistics, or paginated response if params provided
     *
     * @remarks
     * - Without params: returns flat map of all namespaces (backward compatible)
     * - With params: returns paginated response with total count and hasMore flag
     * - Default limit is 100, maximum is 1000
     */
    getAllStats(params?: VectorGetAllStatsParams): Promise<Record<string, VectorNamespaceStats> | VectorStatsPaginated>;
    /**
     * Get all namespace names
     *
     * @returns array of namespace names (up to 1000)
     *
     * @remarks
     * This method returns a maximum of 1000 namespace names.
     * If you have more than 1000 namespaces, only the first 1000
     * (ordered by creation date, most recent first) will be returned.
     *
     * @example
     * ```typescript
     * const namespaces = await vectorStore.getNamespaces();
     * console.log('Namespaces:', namespaces.join(', '));
     * ```
     */
    getNamespaces(): Promise<string[]>;
    /**
     * Delete an entire namespace and all its vectors
     *
     * @param name - the name of the vector storage namespace to delete
     *
     * @example
     * ```typescript
     * await vectorStore.deleteNamespace('old-products');
     * console.log('Namespace deleted');
     * ```
     */
    deleteNamespace(name: string): Promise<void>;
}
export declare class VectorStorageService implements VectorStorage {
    #private;
    constructor(baseUrl: string, adapter: FetchAdapter);
    upsert(name: string, ...documents: VectorUpsertParams[]): Promise<VectorUpsertResult[]>;
    get<T extends Record<string, unknown> = Record<string, unknown>>(name: string, key: string): Promise<VectorResult<T>>;
    getMany<T extends Record<string, unknown> = Record<string, unknown>>(name: string, ...keys: string[]): Promise<Map<string, VectorSearchResultWithDocument<T>>>;
    search<T extends Record<string, unknown> = Record<string, unknown>>(name: string, params: VectorSearchParams<T>): Promise<VectorSearchResult<T>[]>;
    delete(name: string, ...keys: string[]): Promise<number>;
    exists(name: string): Promise<boolean>;
    getStats(name: string): Promise<VectorNamespaceStatsWithSamples>;
    getAllStats(params?: VectorGetAllStatsParams): Promise<Record<string, VectorNamespaceStats> | VectorStatsPaginated>;
    getNamespaces(): Promise<string[]>;
    deleteNamespace(name: string): Promise<void>;
}
//# sourceMappingURL=service.d.ts.map