orchid-orm 1.72.8 → 1.72.9
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 +13 -0
- package/dist/index.js +25 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -10
- package/dist/index.mjs.map +1 -1
- package/dist/migrations/index.js +44 -4
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/index.mjs +45 -5
- package/dist/migrations/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1482,18 +1482,12 @@ const assignTablesToOrm = (isTable, tables, result, adapter, qb, asyncStorage, c
|
|
|
1482
1482
|
comment: table.comment,
|
|
1483
1483
|
readOnly: isTable ? table.readOnly ? true : void 0 : table.materialized || table.readOnly !== false ? true : void 0,
|
|
1484
1484
|
materialized: !isTable && table.materialized ? true : void 0,
|
|
1485
|
+
generatorIgnore: table.generatorIgnore,
|
|
1485
1486
|
noPrimaryKey: table.noPrimaryKey || !isTable ? "ignore" : void 0,
|
|
1486
1487
|
computed: table.computed,
|
|
1487
1488
|
nowSQL: tableClass.nowSQL
|
|
1488
1489
|
};
|
|
1489
|
-
const dbTable = new Db(adapter, qb, isTable ? table.table : table.name, table.columns.shape, table.types, asyncStorage, options, table.columns?.data ?? {}, isTable
|
|
1490
|
-
sql: table.sql,
|
|
1491
|
-
recursive: table.recursive,
|
|
1492
|
-
checkOption: table.checkOption,
|
|
1493
|
-
securityBarrier: table.securityBarrier,
|
|
1494
|
-
securityInvoker: table.securityInvoker,
|
|
1495
|
-
withData: table.withData
|
|
1496
|
-
});
|
|
1490
|
+
const dbTable = new Db(adapter, qb, isTable ? table.table : table.name, table.columns.shape, table.types, asyncStorage, options, table.columns?.data ?? {}, getViewData(isTable, table));
|
|
1497
1491
|
dbTable.definedAs = key;
|
|
1498
1492
|
dbTable.db = result;
|
|
1499
1493
|
dbTable.filePath = table.filePath;
|
|
@@ -1504,6 +1498,18 @@ const assignTablesToOrm = (isTable, tables, result, adapter, qb, asyncStorage, c
|
|
|
1504
1498
|
}
|
|
1505
1499
|
return tableInstances;
|
|
1506
1500
|
};
|
|
1501
|
+
const getViewData = (isTable, table) => {
|
|
1502
|
+
if (isTable) return;
|
|
1503
|
+
return {
|
|
1504
|
+
query: table.query,
|
|
1505
|
+
sql: table.sql,
|
|
1506
|
+
recursive: table.recursive,
|
|
1507
|
+
checkOption: table.checkOption,
|
|
1508
|
+
securityBarrier: table.securityBarrier,
|
|
1509
|
+
securityInvoker: table.securityInvoker,
|
|
1510
|
+
withData: table.withData
|
|
1511
|
+
};
|
|
1512
|
+
};
|
|
1507
1513
|
const bundleOrchidORM = ({ tables = {}, views = {} }) => {
|
|
1508
1514
|
const result = {};
|
|
1509
1515
|
const bundledViews = {};
|
|
@@ -1619,14 +1625,23 @@ const privateOrchidORMWithAdapter = ({ log, logger, autoPreparedStatements, noPr
|
|
|
1619
1625
|
...result.$views
|
|
1620
1626
|
}, schema);
|
|
1621
1627
|
setDbAwareInstance?.(result);
|
|
1622
|
-
const initItems = [[
|
|
1623
|
-
|
|
1628
|
+
const initItems = [[
|
|
1629
|
+
tableInstances,
|
|
1630
|
+
result,
|
|
1631
|
+
true
|
|
1632
|
+
], [
|
|
1633
|
+
viewInstances,
|
|
1634
|
+
result.$views,
|
|
1635
|
+
false
|
|
1636
|
+
]];
|
|
1637
|
+
for (const [items, queries, isTable] of initItems) {
|
|
1624
1638
|
if (!items) continue;
|
|
1625
1639
|
for (const key in items) {
|
|
1626
1640
|
const table = items[key];
|
|
1627
1641
|
if (table.init) {
|
|
1628
1642
|
table.init(result);
|
|
1629
1643
|
Object.assign(queries[key].baseQuery.q, table.q);
|
|
1644
|
+
if (!isTable) queries[key].internal.viewData = getViewData(false, table);
|
|
1630
1645
|
}
|
|
1631
1646
|
}
|
|
1632
1647
|
}
|