i.e., complete of branch https://github.com/uladkasach/schema-generator/tree/features/lazyRef
it('should be possible to declare an entity with a recursive / hierarchial relationship', () => {
const person: Entity = new Entity({
name: 'person',
properties: {
birthday: prop.DATETIME(6),
mother_id: prop.REFERENCES(() => person),
father_id: prop.REFERENCES(() => person),
},
unique: ['birthday', 'mother_id', 'father_id'],
});
});
will need to defer evaluation of fn's until after entity is "initialized" - meaning we probably want an internal and external representation of "Entity":
- internal must have properties defined completely
- external expects properties to be defined w/ lazy load and completely
and then during the normalization step we simply cast each "external" entity into the internal entity, by "evaluating" all of its properties