import type { Property, Parameters } from '../types'; import { DataType } from '../enums'; /** * Represents the guifier parsed data */ export declare class Data { rawData: any; parsedData: Property; params: Parameters; private readonly path; constructor(data: string, dataType: DataType, params: Parameters); /** * This method returns the data */ getData(dataType: DataType): any; /** * This method converts DataType string into a JS object * * @param {string | any} data is the data string * @param {DataType} dataType is the data type * @returns {AnyObject} javascript object */ private deserializeData; /** * This method converts JS object into a DataType string * * @param {string} data is the data JS object * @param {DataType} dataType is the data type * @returns {AnyObject} is data string */ private serializeData; /** * This method adds meta data (private properties) to the data object and all its * nested properties if they dont have it and ignore the ones that have it * * @param {Property} field is the input you want to add meta data to it and to its properties * @param {string} key the key of that property * @returns {Property} the new object containing required meta data (includes meta data added by the user) */ private addMetaDataRecursively; /** * This method fills metadata for properties that dont have metadata. * it fills those required metadata based on the property type * * @example * From this: * ```js * { * name: "malik najjar" * } * ``` * To this: * ```js * { * name: { _path: ["root", "name"], _key: "name", _valueType: "string", _value: "malik najjar" } * } * ``` * * @param {Property} field is the primitive type that will be filled with default meta data * @param {string} key is the key of the property * @param {string[]} path is an array that represents the path of the property * @returns {AnyObject} the new object filled with meta data */ private static addRequiredMetaDataToProperties; /** * This method gives the ability to iterate over parsed data object easily * with a simple for loop syntax * * @example * ```ts * const data = new Data('{"name": "malik"}', 'json') * for (const [obj, path] of data.iterateOverProperties()) { * console.log(path) * console.log(obj) * } * ``` */ iterateOverProperties(property?: Property): Generator<[Property, Array]>; /** * This method normalizes the _rule private parameter of a property * @example * Converts this: * ```js * { * _rules: ["READ_ONLY", "DELETE_DISABLED"] * } * ``` * To this: * ```js * { * _rules: [ * { * rule: "READ_ONLY", * params: null * }, * { * rule: "DELETE_DISABLED", * params: null * } * ] * } * ``` */ private normalizingRules; /** * This method adds an object property. */ addProperty(property: Property): void; /** * This method adds an array element. */ addElement(property: Property): void; /** * This method removes an array element or an object property. */ removeData(propertyPath: Array): void; /** * This method converts this._path array into a js string path thats usable with lodash * @param {boolean} forParsedData is boolean that will make the function generate a path for data that has meta data in it */ private static convertPathArrayToStringPathFormat; /** * This method resets the indexes of the array when there is an empty element in an array */ private static resetArrayIndexes; } //# sourceMappingURL=Data.d.ts.map