import type { DatasetTenancyFilters, ExperimentTenancyFilters, StorageColumn, TABLE_NAMES } from '@mastra/core/storage'; export declare function getSchemaName(schema?: string): string | undefined; export declare function getTableName({ indexName, schemaName }: { indexName: string; schemaName?: string; }): string; /** * Prepare WHERE clause for PostgreSQL queries */ export declare function prepareWhereClause(filters: Record, _schema?: Record): { sql: string; args: any[]; }; /** * Resilient JSON parser for values read from PostgreSQL jsonb columns. * * The `pg` driver auto-deserialises jsonb columns, so: * - jsonb object → JS object (already parsed, just return it) * - jsonb array → JS array (already parsed, just return it) * - jsonb scalar string `"x"` → bare JS string `"x"` (NOT valid JSON to re-parse) * - jsonb null → JS null * * Calling `JSON.parse` on a bare scalar like `"google/gemini-3-flash"` throws, * which combined with fail-fast `.map(parseRow)` in list methods crashes the * entire listing endpoint when a single row contains a jsonb scalar. This * helper falls back to returning the raw value so callers get the same scalar * the driver materialised. * * See https://github.com/mastra-ai/mastra/issues/16224. */ export declare function parseJsonResilient(value: any, _fieldName?: string): any; /** * Transform SQL row to record format, handling JSON columns */ export declare function transformFromSqlRow({ tableName, sqlRow, }: { tableName: TABLE_NAMES; sqlRow: Record; }): T; /** * Tenancy scope shape shared by domains that carry `organizationId` / `projectId` * columns (datasets, experiments, ...). Aliases the core tenancy filter types so * this helper stays in sync if the core shape ever changes. */ export type TenancyScope = DatasetTenancyFilters | ExperimentTenancyFilters; /** * Build additional `AND "col" = $N` conditions for a tenancy read-scope filter. * Uses double-quoted PG identifiers and continues numbering from `startIndex`. * Returns empty arrays and unchanged `nextIndex` when no filters apply. * * Shared across domains (datasets, experiments, ...) so tenancy predicates stay * consistent and cross-tenant reads/deletes do not leak. */ export declare function tenancyWhere(filters: TenancyScope | undefined, startIndex: number): { conditions: string[]; params: any[]; nextIndex: number; }; //# sourceMappingURL=utils.d.ts.map