@gmetrixr/rjson
Version:
(R)ecursive Json
36 lines (35 loc) • 1.06 kB
TypeScript
import { RecordNode, RT } from "../../../r";
/**
* WIP
* Migration to check and fix record integrity
* Redundancies in rjson that can cause inconsistencies:
* NODE:
* id: 223344
* type: project
* props: <key|value>
* records: {
* TypeA: {
* map: {
* id1: {id: id1, type: TypeA, props, records} // I. id, type in subnode can differer from the map key
* id2: {id: id2, type: TypeA, props, records}
* },
* order: [id1, id2] // II. ids can differ from map keys
* }
* TypeB: {
* map: {
* id1: {id: id3, type: TypeB, props, records}
* id2: {id: id4, type: TypeB, props, records}
* },
* order: [id3, id4]
* }
* }
*/
declare class HealthcheckMigration {
execute(projectJson: unknown): {
corrections: string[];
};
fixRecord(json: RecordNode<RT>, corrections: string[]): void;
}
declare const healthCheckMigration: HealthcheckMigration;
declare const confirmNoCorruption: (json: RecordNode<RT>) => boolean;
export { healthCheckMigration, confirmNoCorruption };