Describe the bug
When an entity has functions, a TypeError: Cannot read properties of undefined (reading 'isId') occurs.
I verified that this occurs in the getEntityIds function, as the entity fields are obtained through entity.prototype.meta.schema, but before filtering the id fields, you must go through this list again to filter the functions, as functions do not have the options field, resulting in an attempt to read the property of an undefined.
To Reproduce
Create a project with Herbs2Knex, whose entity has functions, then try to run the project, making insertions and searches in the database.
Expected behavior
The behavior is that this exception is not thrown.
Screenshots
Additional context
I believe this can be resolved by adding a .filter((field) => typeof field != 'function') in the idFields constant.
Describe the bug When an entity has functions, a
TypeError: Cannot read properties of undefined (reading 'isId')
occurs.I verified that this occurs in the
getEntityIds
function, as the entity fields are obtained throughentity.prototype.meta.schema
, but before filtering the id fields, you must go through this list again to filter the functions, as functions do not have the options field, resulting in an attempt to read the property of an undefined.To Reproduce Create a project with Herbs2Knex, whose entity has functions, then try to run the project, making insertions and searches in the database.
Expected behavior The behavior is that this exception is not thrown.
Screenshots
Additional context I believe this can be resolved by adding a
.filter((field) => typeof field != 'function')
in the idFields constant.