orchid-orm 1.31.0 → 1.31.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 +96 -110
- package/dist/index.js +15 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -299,8 +299,8 @@ class BelongsToVirtualColumn extends VirtualColumn {
|
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
const makeBelongsToMethod = (relation, relationName, query) => {
|
|
302
|
-
const primaryKeys =
|
|
303
|
-
const foreignKeys =
|
|
302
|
+
const primaryKeys = relation.options.references;
|
|
303
|
+
const foreignKeys = relation.options.columns;
|
|
304
304
|
const len = primaryKeys.length;
|
|
305
305
|
const state = { query, primaryKeys, foreignKeys, len };
|
|
306
306
|
const makeWhere = relationWhere(len, primaryKeys, foreignKeys);
|
|
@@ -617,8 +617,8 @@ const makeHasOneMethod = (table, relation, relationName, query) => {
|
|
|
617
617
|
reverseJoin: reverseJoin2
|
|
618
618
|
};
|
|
619
619
|
}
|
|
620
|
-
const primaryKeys =
|
|
621
|
-
const foreignKeys =
|
|
620
|
+
const primaryKeys = relation.options.columns;
|
|
621
|
+
const foreignKeys = relation.options.references;
|
|
622
622
|
const state = { query, primaryKeys, foreignKeys };
|
|
623
623
|
const len = primaryKeys.length;
|
|
624
624
|
const reversedOn = {};
|
|
@@ -879,8 +879,8 @@ const makeHasManyMethod = (table, relation, relationName, query) => {
|
|
|
879
879
|
reverseJoin: reverseJoin2
|
|
880
880
|
};
|
|
881
881
|
}
|
|
882
|
-
const primaryKeys =
|
|
883
|
-
const foreignKeys =
|
|
882
|
+
const primaryKeys = relation.options.columns;
|
|
883
|
+
const foreignKeys = relation.options.references;
|
|
884
884
|
const state = { query, primaryKeys, foreignKeys };
|
|
885
885
|
const len = primaryKeys.length;
|
|
886
886
|
const reversedOn = {};
|
|
@@ -977,7 +977,10 @@ const nestedInsert$1 = ({ query, primaryKeys, foreignKeys }) => {
|
|
|
977
977
|
obj[foreignKeys[i2]] = selfData[primaryKeys[i2]];
|
|
978
978
|
}
|
|
979
979
|
queries.push(
|
|
980
|
-
_queryUpdate(
|
|
980
|
+
_queryUpdate(
|
|
981
|
+
t.where(item.where),
|
|
982
|
+
obj
|
|
983
|
+
)
|
|
981
984
|
);
|
|
982
985
|
}
|
|
983
986
|
}
|
|
@@ -1147,25 +1150,12 @@ const removeColumnName = (column) => {
|
|
|
1147
1150
|
return cloned;
|
|
1148
1151
|
};
|
|
1149
1152
|
const makeHasAndBelongsToManyMethod = (table, qb, relation, relationName, query) => {
|
|
1150
|
-
let primaryKeys;
|
|
1151
|
-
let foreignKeys;
|
|
1152
|
-
let joinTable;
|
|
1153
|
-
let throughForeignKeys;
|
|
1154
|
-
let throughPrimaryKeys;
|
|
1155
1153
|
const { options } = relation;
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
throughPrimaryKeys = options.through.references;
|
|
1162
|
-
} else {
|
|
1163
|
-
primaryKeys = [options.primaryKey];
|
|
1164
|
-
foreignKeys = [options.foreignKey];
|
|
1165
|
-
joinTable = options.joinTable;
|
|
1166
|
-
throughForeignKeys = [options.associationForeignKey];
|
|
1167
|
-
throughPrimaryKeys = [options.associationPrimaryKey];
|
|
1168
|
-
}
|
|
1154
|
+
const primaryKeys = options.columns;
|
|
1155
|
+
const foreignKeys = options.references;
|
|
1156
|
+
const joinTable = options.through.table;
|
|
1157
|
+
const throughForeignKeys = options.through.columns;
|
|
1158
|
+
const throughPrimaryKeys = options.through.references;
|
|
1169
1159
|
const { snakeCase } = table.internal;
|
|
1170
1160
|
const foreignKeysFull = foreignKeys.map((key, i) => {
|
|
1171
1161
|
if (snakeCase)
|