/** * Translation result and JSON helpers. * * @internal */ import type { DataSource, JSONObject } from '@sisense/sdk-data'; import type { WidgetsOptions } from '../../../../../domains/dashboarding/dashboard-model/types.js'; import type { NlqTranslationError, NlqTranslationResult } from '../../../types.js'; import type { DataSourceJSON, WidgetsOptionsJSON } from '../../types.js'; type WithOptionalToJSON = { toJSON?: () => JSONObject; }; /** * Returns a JSON-friendly snapshot for translation error reporting. * Uses `toJSON()` when present (CSDK Attribute/Measure); otherwise returns the value as-is. * * @internal */ /** * Serializes a CSDK data source to NLQ JSON (title string only). * * @param dataSource - Widget or dashboard data source * @returns Data source title for JSON output * @internal */ export declare function translateDataSourceToJSON(dataSource: DataSource): DataSourceJSON; /** * Extracts JSON-serializable widget options from dashboard `widgetsOptions`. * Omits `jtdConfig` and other non-JSON-safe fields. * * @param widgetsOptions - Dashboard widget options map * @returns Widget options safe for NLQ JSON, or `undefined` when empty * @internal */ export declare function translateWidgetsOptionsToJSON(widgetsOptions: WidgetsOptions): WidgetsOptionsJSON | undefined; export declare function toNlqErrorInput(value: WithOptionalToJSON | unknown): unknown; /** * Recursively strips [[delimiters]] from all strings in a JSON structure. * Transforms "DM.[[Commerce Sales]].[[Order Date]]" → "DM.Commerce Sales.Order Date" * * Accepts NLQ output shapes (e.g. ChartJSON) that are JSON-serializable at runtime but are not * assignable to sdk-data `JSONValue` because of `Record` style fields. * * @param value - The value to process * @returns The value with all [[delimiters]] stripped from strings * @internal */ export declare function stripDelimitersFromJson(value: T): T; export declare function getSuccessData(result: NlqTranslationResult): T; export declare function getErrors(result: NlqTranslationResult): string[]; /** * Helper function to collect structured errors from translation operations. * * Executes a translation function and collects any errors into the provided errors array. * Returns the translated data if successful, or null if errors occurred. * * @param translateFn - Function that returns a NlqTranslationResult * @param errors - Array to collect errors into * @param mapError - Optional mapper to transform errors before pushing (e.g., add axis context for chart dataOptions) * @returns The translated data if successful, or null if errors occurred * @internal */ export declare function collectTranslationErrors(translateFn: () => NlqTranslationResult, errors: NlqTranslationError[], mapError?: (e: NlqTranslationError) => NlqTranslationError): T | null; export {};