orchid-orm 1.5.28 → 1.5.30
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.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -22
- package/.env.example +0 -1
- package/.turbo/turbo-test.log +0 -26
- package/.turbo/turbo-test:ci.log +0 -26
- package/CHANGELOG.md +0 -375
- package/coverage/coverage-summary.json +0 -28
- package/jest-setup.ts +0 -11
- package/rollup.config.js +0 -18
- package/src/bin/bin.ts +0 -3
- package/src/bin/init.test.ts +0 -810
- package/src/bin/init.ts +0 -529
- package/src/codegen/appCodeUpdater.test.ts +0 -75
- package/src/codegen/appCodeUpdater.ts +0 -53
- package/src/codegen/createBaseTableFile.test.ts +0 -53
- package/src/codegen/createBaseTableFile.ts +0 -31
- package/src/codegen/fileChanges.ts +0 -41
- package/src/codegen/testUtils.ts +0 -56
- package/src/codegen/tsUtils.ts +0 -180
- package/src/codegen/updateMainFile.test.ts +0 -253
- package/src/codegen/updateMainFile.ts +0 -210
- package/src/codegen/updateTableFile/changeTable.test.ts +0 -804
- package/src/codegen/updateTableFile/changeTable.ts +0 -536
- package/src/codegen/updateTableFile/createTable.test.ts +0 -139
- package/src/codegen/updateTableFile/createTable.ts +0 -51
- package/src/codegen/updateTableFile/renameTable.test.ts +0 -124
- package/src/codegen/updateTableFile/renameTable.ts +0 -67
- package/src/codegen/updateTableFile/updateTableFile.ts +0 -22
- package/src/codegen/utils.ts +0 -13
- package/src/index.ts +0 -5
- package/src/orm.test.ts +0 -92
- package/src/orm.ts +0 -98
- package/src/relations/belongsTo.test.ts +0 -1122
- package/src/relations/belongsTo.ts +0 -352
- package/src/relations/hasAndBelongsToMany.test.ts +0 -1335
- package/src/relations/hasAndBelongsToMany.ts +0 -472
- package/src/relations/hasMany.test.ts +0 -2616
- package/src/relations/hasMany.ts +0 -401
- package/src/relations/hasOne.test.ts +0 -1701
- package/src/relations/hasOne.ts +0 -351
- package/src/relations/relations.test.ts +0 -37
- package/src/relations/relations.ts +0 -363
- package/src/relations/utils.ts +0 -162
- package/src/repo.test.ts +0 -200
- package/src/repo.ts +0 -119
- package/src/table.test.ts +0 -121
- package/src/table.ts +0 -184
- package/src/test-utils/test-db.ts +0 -32
- package/src/test-utils/test-tables.ts +0 -194
- package/src/test-utils/test-utils.ts +0 -119
- package/src/transaction.test.ts +0 -47
- package/src/transaction.ts +0 -27
- package/src/utils.ts +0 -9
- package/tsconfig.json +0 -14
package/dist/index.mjs
CHANGED
|
@@ -804,14 +804,14 @@ const makeHasAndBelongsToManyMethod = (table, qb, relation, relationName, query)
|
|
|
804
804
|
const foreignKeyFull = `${joinTable}.${fk}`;
|
|
805
805
|
const associationForeignKeyFull = `${joinTable}.${afk}`;
|
|
806
806
|
const associationPrimaryKeyFull = `${getQueryAs(query)}.${apk}`;
|
|
807
|
-
const
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
807
|
+
const baseQuery = Object.create(qb.baseQuery);
|
|
808
|
+
baseQuery.baseQuery = baseQuery;
|
|
809
|
+
baseQuery.table = joinTable;
|
|
810
|
+
baseQuery.shape = {
|
|
811
811
|
[fk]: table.shape[pk],
|
|
812
812
|
[afk]: query.shape[apk]
|
|
813
813
|
};
|
|
814
|
-
const subQuery = Object.create(
|
|
814
|
+
const subQuery = Object.create(baseQuery);
|
|
815
815
|
subQuery.query = __spreadValues$4({}, subQuery.query);
|
|
816
816
|
const state = {
|
|
817
817
|
relatedTableQuery: query,
|
|
@@ -1235,7 +1235,7 @@ function transaction(fn) {
|
|
|
1235
1235
|
const value = this[key];
|
|
1236
1236
|
if (value instanceof Db) {
|
|
1237
1237
|
const table = value.transacting(q);
|
|
1238
|
-
table.
|
|
1238
|
+
table.baseQuery = table;
|
|
1239
1239
|
table.db = orm;
|
|
1240
1240
|
orm[key] = table;
|
|
1241
1241
|
} else {
|
|
@@ -1359,16 +1359,16 @@ const createRepo = (table, methods) => {
|
|
|
1359
1359
|
const queryMethods = __spreadValues$2(__spreadValues$2(__spreadValues$2(__spreadValues$2({}, methods.queryMethods), methods.queryOneMethods), methods.queryWithWhereMethods), methods.queryOneWithWhereMethods);
|
|
1360
1360
|
const plainMethods = methods.methods;
|
|
1361
1361
|
const repo = (q2) => {
|
|
1362
|
-
const proto = Object.create(q2.
|
|
1363
|
-
proto.
|
|
1362
|
+
const proto = Object.create(q2.baseQuery);
|
|
1363
|
+
proto.baseQuery = proto;
|
|
1364
1364
|
const result = Object.create(proto);
|
|
1365
1365
|
result.query = getClonedQueryData(q2.query);
|
|
1366
1366
|
if (plainMethods) {
|
|
1367
|
-
Object.assign(proto.
|
|
1367
|
+
Object.assign(proto.baseQuery, plainMethods);
|
|
1368
1368
|
}
|
|
1369
1369
|
for (const key in queryMethods) {
|
|
1370
1370
|
const method = queryMethods[key];
|
|
1371
|
-
proto.
|
|
1371
|
+
proto.baseQuery[key] = function(...args) {
|
|
1372
1372
|
return method(this, ...args);
|
|
1373
1373
|
};
|
|
1374
1374
|
}
|