metal-orm 1.0.30 → 1.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metal-orm",
3
- "version": "1.0.30",
3
+ "version": "1.0.33",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "engines": {
@@ -122,6 +122,9 @@ export const bootstrapEntities = (): TableDef[] => {
122
122
  export const getTableDefFromEntity = (ctor: EntityConstructor): TableDef | undefined => {
123
123
  const meta = getEntityMetadata(ctor);
124
124
  if (!meta) return undefined;
125
+ if (!meta.table) {
126
+ bootstrapEntities();
127
+ }
125
128
  return meta.table;
126
129
  };
127
130
 
@@ -130,7 +133,7 @@ export const selectFromEntity = <TTable extends TableDef>(
130
133
  ): SelectQueryBuilder<any, TTable> => {
131
134
  const table = getTableDefFromEntity(ctor);
132
135
  if (!table) {
133
- throw new Error('Entity metadata has not been bootstrapped');
136
+ throw new Error(`Entity '${ctor.name}' is not registered with decorators or has not been bootstrapped`);
134
137
  }
135
138
  return new SelectQueryBuilder(table as TTable);
136
139
  };