UNPKG

@golemio/pid

Version:
22 lines (21 loc) 999 B
export declare class RedisJsonParser { /** * Parses a Redis JSON.GET response when multiple properties are requested. * For multiple properties, the result is like: { "$.a": [valueA], "$.b": [valueB] }. * * @param json - The JSON string or object to parse. * @param context - Additional context for error handling. * @returns The parsed object with unwrapped values. */ static parse<T extends object>(json: string | object, context: string): T; /** * Parses a Redis JSON.GET response when a single property is requested. * Result for one property is like: [ [ ...value... ] ]. * * @param json - The JSON string or object to parse. * @param context - Additional context for error handling. * @param property - The property name to extract. * @returns An object with the extracted property. */ static parseSingle<T extends object, K extends keyof T>(json: unknown, context: string, property: K): Pick<T, K>; }