orchid-orm 1.72.0 → 1.72.2
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/dist/index.d.ts +7 -0
- package/dist/index.js +10 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -184,6 +184,13 @@ interface OrchidORMQueryHelper<Q extends Query, Args extends unknown[], Result>
|
|
|
184
184
|
__result: Result;
|
|
185
185
|
}
|
|
186
186
|
interface OrchidORMTableHelper<T extends Query> {
|
|
187
|
+
/**
|
|
188
|
+
* Static table name from the table class.
|
|
189
|
+
*/
|
|
190
|
+
table: T['table'];
|
|
191
|
+
/**
|
|
192
|
+
* Create a helper that binds to the DB-aware table query when used.
|
|
193
|
+
*/
|
|
187
194
|
makeHelper<Args extends unknown[], Result>(fn: (q: T, ...args: Args) => Result): OrchidORMQueryHelper<T, Args, Result>;
|
|
188
195
|
}
|
|
189
196
|
type OrchidORMTables<T extends TableClasses = TableClasses> = { [K in keyof T]: T[K] extends {
|
package/dist/index.js
CHANGED
|
@@ -1420,13 +1420,16 @@ const assignTablesToOrm = (tables, result, adapter, qb, asyncStorage, commonOpti
|
|
|
1420
1420
|
const bundleOrchidORMTables = (tables) => {
|
|
1421
1421
|
const result = {};
|
|
1422
1422
|
let dbAwareInstance;
|
|
1423
|
-
for (const key in tables) result[key] = {
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
return
|
|
1428
|
-
|
|
1429
|
-
|
|
1423
|
+
for (const key in tables) result[key] = {
|
|
1424
|
+
table: tables[key].instance().table,
|
|
1425
|
+
makeHelper(arg) {
|
|
1426
|
+
let fn;
|
|
1427
|
+
return (...args) => {
|
|
1428
|
+
if (!fn) fn = dbAwareInstance[key].makeHelper(arg);
|
|
1429
|
+
return fn(...args);
|
|
1430
|
+
};
|
|
1431
|
+
}
|
|
1432
|
+
};
|
|
1430
1433
|
Object.defineProperty(result, orchidORMBundleMetadataKey, {
|
|
1431
1434
|
enumerable: false,
|
|
1432
1435
|
value: {
|