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/README.md +7 -7
- package/dist/decorators/index.cjs +4 -1
- package/dist/decorators/index.cjs.map +1 -1
- package/dist/decorators/index.js +4 -1
- package/dist/decorators/index.js.map +1 -1
- package/dist/index.cjs +108 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +108 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/decorators/bootstrap.ts +4 -1
package/package.json
CHANGED
|
@@ -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(
|
|
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
|
};
|