import type { RecordEntry, RecordMap, RecordNode, rAndP } from "./RecordNode"; import { RT } from "./RecordTypes"; export declare class RecordUtils { static getDefaultValues: (type: N) => Record; static getRecordEntries(rm: RecordMap): RecordEntry[]; static getRecords(rm: RecordMap): RecordNode[]; static getRecordIds(rm: RecordMap): number[]; /** ORDERED entries of id, records. Returns ids as strings. */ static getSortedRecordEntries(rm: RecordMap): RecordEntry[]; /** ORDERED ids */ static getSortedRecordIds(rm: RecordMap): number[]; /** ORDERED records */ static getSortedRecords(rm: RecordMap): RecordNode[]; static getDeepRecordAndParentArray(record: RecordNode, rAndPArray: rAndP[]): rAndP[]; /** * Ensures that all records of a given type have the ".order" key in them. * This function finds the max order, and increments the order by 1 for each new entry */ private static ensureOrderKeyPresentOfType; /** * Adding ".order" key to the new entry - even if the record already had a .order, we will overwrite it * potential value of respective orders: [4, 4.5, 4.75, 5, 8] * newRecordsCount: the number of new records to enter * meaning of "position" - the [gap] to insert into: [0] 0, [1] 1, [2] 2, [3] 3, [4] 4 [5] * if this is the only record, order = 1 * if its inserted at [0], order = order of the first entry - 1 * if its inserted at [5], order = order of the last entry + 1 (default, when position is undefined) * if its inserted at [x], order = ( order of [x - 1] entry + order of [x] entry ) / 2 */ static getNewOrders(sortedRecords: RecordNode[], newRecordsCount: number, position?: number): number[]; /** * In case the difference in order gets dangerously close the JS's Number.MIN_VALUE, reset orders * The second argument is optional, and provided only for testing */ private static ensureMinDistanceOfOrders; }