import type { Field, SanitizedConfig, TypeWithID } from 'payload'; import type { DataRow, PaginatedResult } from '../types.js'; /** * Strip sensitive fields from document data * Similar to MongoDB's stripFields function in transform.ts */ export declare function stripSensitiveFields(data: Record): Record; /** * Strip fields that are not defined in the collection schema * Used during read operations to ensure only valid fields are returned */ export declare function stripUndefinedFields(data: Record, config: SanitizedConfig, fields: Field[], reservedKeys?: string[]): Record; /** * Parse the data field from a ClickHouse row * Handles both string JSON and already parsed objects */ export declare function parseDataRow(row: DataRow): DataRow; /** * Check if a collection has a custom numeric ID field */ export declare function hasCustomNumericID(fields: Field[]): boolean; /** * Convert ID to the appropriate type based on collection config */ export declare function convertID(id: string, isNumeric: boolean): number | string; /** * Transform a ClickHouse row to a Payload document * @param row The data row from ClickHouse * @param numericID If true, convert ID to number (for collections with custom numeric ID fields) */ export declare function rowToDocument(row: DataRow, numericID?: boolean): T; /** * Transform an array of ClickHouse rows to Payload documents * @param rows The data rows from ClickHouse * @param numericID If true, convert IDs to numbers (for collections with custom numeric ID fields) */ export declare function rowsToDocuments(rows: DataRow[], numericID?: boolean): T[]; /** * Create a paginated result object */ export declare function createPaginatedResult(docs: T[], totalDocs: number, page: number, limit: number): PaginatedResult; /** * Extract the title field value from document data */ export declare function extractTitle(data: Record, titleField: string | undefined, id: string): string; /** * Convert a Payload document to insert data */ export declare function documentToInsertData(doc: Record, options: { existingCreatedAt?: number; existingCreatedBy?: null | string; id: string; isUpdate?: boolean; ns: string; titleField?: string; type: string; userId?: string; }): { createdAt: number; createdBy: null | string; data: string; deletedAt: null | number; deletedBy: null | string; id: string; ns: string; title: string; type: string; updatedAt: number; updatedBy: null | string; v: number; }; /** * Parse a DateTime64 string from ClickHouse to a Date object * Handles ClickHouse DateTime64 format which doesn't include timezone info */ export declare function parseDateTime64(value: string): Date; /** * Parse a DateTime64 string to milliseconds timestamp * Handles ClickHouse DateTime64 format which doesn't include timezone info */ export declare function parseDateTime64ToMs(value: string): number; /** * Convert ClickHouse DateTime format to ISO 8601 format * ClickHouse returns: "2021-01-01 00:00:00.000" (without timezone) * ISO 8601 expects: "2021-01-01T00:00:00.000Z" * * Important: ClickHouse DateTime64 values are stored/returned in UTC when session_timezone='UTC', * but the string doesn't include timezone info. We must append 'Z' to indicate UTC. */ export declare function toISOString(value: null | string | undefined): string | undefined; /** * Deep merge two objects * Used to properly merge localized data without losing locale keys * * Handles edge cases: * - Circular references (uses seen WeakSet to detect and skip) * - Null prototype objects * - Arrays are not merged, source overwrites target * - $push operator: appends items to existing array, avoiding duplicates * - $remove operator: removes items from existing array * - Dot notation keys: 'a.b.c' is expanded to nested { a: { b: { c: ... } } } */ export declare function deepMerge>(target: T, source: Record, seen?: WeakSet): T; //# sourceMappingURL=transform.d.ts.map