/** * CosmosDB client types. */ import type { z } from "zod"; import type { BaseIntegrationClient } from "../../types.js"; import type { TraceMetadata } from "../registry.js"; /** * Options for CosmosDB SQL queries. */ export interface CosmosDBQueryOptions { /** Enable cross-partition queries. Defaults to false. */ crossPartition?: boolean; /** Partition key value to scope the query. */ partitionKey?: string; } /** * CosmosDB client for SQL queries and point operations. * * Provides methods for querying containers with SQL and performing * CRUD operations on individual documents. * * @example * ```typescript * // Declare in api(): integrations: { cosmos: cosmosdb(INTEGRATION_ID) } * // In run(), access via ctx.integrations.cosmos * * // SQL query * const users = await cosmos.query( * 'users', * 'SELECT * FROM c WHERE c.status = "active"', * UserSchema, * ); * * // Read a document * const user = await cosmos.read('users', 'user-123', UserSchema); * * // Create a document * await cosmos.create('users', { id: 'user-456', name: 'Alice' }); * * // Replace a document * await cosmos.replace('users', { id: 'user-456', name: 'Bob' }); * * // Upsert a document * await cosmos.upsert('users', { id: 'user-789', name: 'Charlie' }); * * // Delete a document * await cosmos.deleteItem('users', 'user-456'); * ``` */ export interface CosmosDBClient extends BaseIntegrationClient { /** * Execute a SQL query against a CosmosDB container. * * @param containerId - The container to query * @param sql - The SQL query string * @param schema - Zod schema for validating the result * @param options - Optional query configuration (crossPartition, partitionKey) * @returns The validated query result */ query(containerId: string, sql: string, schema: z.ZodSchema, options?: CosmosDBQueryOptions, metadata?: TraceMetadata): Promise; /** * Read a single document by ID. * * @param containerId - The container to read from * @param id - The document ID * @param schema - Zod schema for validating the result * @param partitionKey - Optional partition key value * @param metadata - Optional trace metadata for diagnostics * @returns The validated document */ read(containerId: string, id: string, schema: z.ZodSchema, partitionKey?: string, metadata?: TraceMetadata): Promise; /** * Create a new document in a container. * * @param containerId - The container to create in * @param body - The document to create (will be JSON-serialized) * @param partitionKey - Optional partition key value * @param metadata - Optional trace metadata for diagnostics * @returns The raw result from CosmosDB */ create(containerId: string, body: unknown, partitionKey?: string, metadata?: TraceMetadata): Promise; /** * Replace an existing document in a container. * * @param containerId - The container containing the document * @param body - The replacement document (will be JSON-serialized) * @param partitionKey - Optional partition key value * @param metadata - Optional trace metadata for diagnostics * @returns The raw result from CosmosDB */ replace(containerId: string, body: unknown, partitionKey?: string, metadata?: TraceMetadata): Promise; /** * Upsert (create or replace) a document in a container. * * @param containerId - The container to upsert into * @param body - The document to upsert (will be JSON-serialized) * @param partitionKey - Optional partition key value * @param metadata - Optional trace metadata for diagnostics * @returns The raw result from CosmosDB */ upsert(containerId: string, body: unknown, partitionKey?: string, metadata?: TraceMetadata): Promise; /** * Delete a document by ID from a container. * * @param containerId - The container containing the document * @param id - The document ID to delete * @param partitionKey - Optional partition key value * @param metadata - Optional trace metadata for diagnostics * @returns The raw result from CosmosDB */ deleteItem(containerId: string, id: string, partitionKey?: string, metadata?: TraceMetadata): Promise; } //# sourceMappingURL=types.d.ts.map