/** * TONL (Token-Optimized Notation Language) - A text-first, LLM-friendly serialization format * * Main entry point exporting the core TONL API. */ export type { EncodeOptions, DecodeOptions } from "./types.js"; export type { TONLValue, TONLObject, TONLArray, TONLTypeHint, TONLDelimiter } from "./types.js"; import type { TONLValue } from "./types.js"; import { encodeTONL as _encodeTONL } from "./encode.js"; import { decodeTONL as _decodeTONL } from "./decode.js"; import { parseTONLLine, parseHeaderLine, parseObjectHeader, detectDelimiter } from "./parser.js"; import { inferPrimitiveType, coerceValue, isUniformObjectArray } from "./infer.js"; export { _encodeTONL as encodeTONL, _decodeTONL as decodeTONL, parseTONLLine, parseHeaderLine, parseObjectHeader, detectDelimiter, inferPrimitiveType, coerceValue, isUniformObjectArray }; /** * Smart encode a JavaScript value to TONL with automatic optimization. * * Analyzes the input data to automatically select the best delimiter * that minimizes quoting and maximizes token efficiency. This is the * recommended encoding function for LLM contexts where token cost matters. * * @param input - The value to encode (object, array, or primitive) * @param opts - Optional encoding options (delimiter is auto-selected if not specified) * @param opts.delimiter - Override automatic delimiter selection * @param opts.includeTypes - Add type hints to headers (default: false) * @param opts.version - TONL version string (default: "1.0") * @param opts.indent - Spaces per indentation level (default: 2) * @param opts.singleLinePrimitiveLists - Encode primitive arrays on single line (default: true) * @param opts.compactTables - Use compact table format when possible (default: false) * @param opts.schemaFirst - Output schema before data (default: false) * @returns TONL formatted string optimized for minimal token usage * @throws {Error} When circular reference detected in input * @throws {Error} When maximum nesting depth exceeded * * @example * ```typescript * // Automatic delimiter selection based on content * const tonl = encodeSmart({ message: 'Hello, World!' }); * // Uses '|' delimiter since commas appear in content * * // With additional options * const tonl = encodeSmart(data, { includeTypes: true }); * ``` * * @since 1.0.0 * @see encodeTONL - For manual delimiter control * @see decodeTONL - For decoding TONL back to JavaScript */ export declare function encodeSmart(input: TONLValue, opts?: { delimiter?: "," | "|" | "\t" | ";"; includeTypes?: boolean; version?: string; indent?: number; singleLinePrimitiveLists?: boolean; compactTables?: boolean; schemaFirst?: boolean; }): string; export { TONLDocument, type DocumentStats } from './document.js'; export { FileEditor, type FileEditorOptions, type DiffResult, type DiffEntry } from './modification/index.js'; export { streamQuery, streamAggregate, streamCount, streamCollect, StreamPipeline, type StreamQueryOptions } from './stream/index.js'; export { TONLREPL, type REPLOptions } from './repl/index.js'; export { DictionaryBuilder, DictionaryDecoder, ColumnReorderer, NumericQuantizer, DeltaEncoder, DeltaDecoder, RunLengthEncoder, RunLengthDecoder, AdaptiveOptimizer, BitPacker, BitPackDecoder, SchemaInheritance, HierarchicalGrouping, TokenizerAware, type Dictionary, type DictionaryEntry, type DictionaryOptions, type QuantizationOptions, type PrecisionAnalysis, type DeltaOptions, type DeltaAnalysis, type RLEOptions, type RLEAnalysis, type BitPackOptions, type BitPackAnalysis, type SchemaInheritOptions, type Schema, type ColumnSchema, type SchemaAnalysis, type HierarchicalOptions, type HierarchyNode, type HierarchyAnalysis, type TokenizerAwareOptions, type TokenizerAnalysis, type AdaptiveOptions, type ColumnAnalysis, type OptimizationStrategy, type ColumnReorderResult, type Run, type OptimizationAnalysis, type EncodingHints } from './optimization/index.js'; //# sourceMappingURL=index.d.ts.map