@yogesh0333/yogiway
Version:
YOGIWAY Format - Ultra-compact, nested-aware data format for LLM prompts. Handles deeply nested JSON efficiently, 10-15% more efficient than TOON.
58 lines • 2.46 kB
TypeScript
/**
* YOGIWAY Format v2 - Ultra-compact, nested-aware data format for LLM prompts
* Improved with circular reference detection, path compression, and adaptive flattening
* FREE AND OPEN SOURCE - No license required
*/
export type YogiwayMode = "compatibility" | "performance" | "minimal";
export interface YogiwayEncodeOptions {
/** Use tab delimiters (default: true) */
useTabs?: boolean;
/** Abbreviate collection names (default: true) */
abbreviateNames?: boolean;
/** Include type hints (default: false) */
includeTypes?: boolean;
/** Maximum nesting depth (default: 100) */
maxDepth?: number;
/** Flatten nested structures (default: true) */
flattenNested?: boolean;
/** Compress paths for deep nesting (default: true) */
compressPaths?: boolean;
/** Adaptive flattening - only flatten when beneficial (default: true) */
adaptiveFlattening?: boolean;
/** Use path references to cache repeated paths (default: true) */
usePathReferences?: boolean;
/** Encoding mode: compatibility (JSON-like), performance (fast), minimal (smallest) (default: 'performance') */
mode?: YogiwayMode;
/** Enable compression for large data (default: false) */
compress?: boolean;
/** Lazy path resolution for deep nesting (default: true) */
lazyPaths?: boolean;
/** Streaming chunk size for large arrays (default: 8192) */
streamingChunkSize?: number;
}
export interface YogiwayDecodeOptions {
/** Field name mapping (if custom abbreviations used) */
fieldMapping?: Record<string, string>;
/** Collection name mapping */
collectionMapping?: Record<string, string>;
/** Restore nested structure from flattened paths */
restoreNested?: boolean;
/** Maximum nesting depth for decoding */
maxDepth?: number;
}
/**
* Encode JavaScript object to YOGIWAY format
*/
export declare function encode(data: any, options?: YogiwayEncodeOptions): string;
/**
* Decode YOGIWAY format to JavaScript object
*/
export declare function decode(yogiway: string, options?: YogiwayDecodeOptions): any;
export { pathxEncode, pathxDecode, type PathxEncodeOptions, type PathxDecodeOptions, } from "./pathx";
export { yogiwayToPathx, pathxToYogiway, toPathx, fromPathx, toYogiway, fromYogiway, smartEncode, } from "./converter";
declare const _default: {
encode: typeof encode;
decode: typeof decode;
};
export default _default;
//# sourceMappingURL=index.d.ts.map