orchid-orm 1.6.39 → 1.6.40

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.mjs CHANGED
@@ -871,6 +871,8 @@ const makeHasAndBelongsToManyMethod = (table, qb, relation, relationName, query)
871
871
  relationName,
872
872
  state
873
873
  ),
874
+ // joinQuery can be a property of RelationQuery and be used by whereExists and other stuff which needs it
875
+ // and the chained query itself may be a query around this joinQuery
874
876
  joinQuery(fromQuery, toQuery) {
875
877
  const join = toQuery.whereExists(
876
878
  subQuery,
@@ -897,6 +899,7 @@ const makeHasAndBelongsToManyMethod = (table, qb, relation, relationName, query)
897
899
  const fromQuery = ref.query.clone();
898
900
  fromQuery.query.select = [{ selectAs: { [fk]: pk } }];
899
901
  const createdCount = await subQuery.transacting(q).count()._createFrom(
902
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
900
903
  fromQuery,
901
904
  {
902
905
  [afk]: result[apk]
@@ -1064,15 +1067,18 @@ const nestedUpdate = (state) => {
1064
1067
  if (params.update) {
1065
1068
  await state.relatedTableQuery.transacting(q)._whereExists(
1066
1069
  state.joinTableQuery,
1067
- (q2) => q2._on(
1068
- state.associationForeignKeyFull,
1069
- state.associationPrimaryKeyFull
1070
- )._where({
1071
- IN: {
1072
- columns: [state.foreignKeyFull],
1073
- values: [data.map((item) => item[state.primaryKey])]
1074
- }
1075
- })
1070
+ (q2) => (
1071
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1072
+ q2._on(
1073
+ state.associationForeignKeyFull,
1074
+ state.associationPrimaryKeyFull
1075
+ )._where({
1076
+ IN: {
1077
+ columns: [state.foreignKeyFull],
1078
+ values: [data.map((item) => item[state.primaryKey])]
1079
+ }
1080
+ })
1081
+ )
1076
1082
  )._where(
1077
1083
  Array.isArray(params.update.where) ? { OR: params.update.where } : params.update.where
1078
1084
  )._update(params.update.data);
@@ -1369,6 +1375,7 @@ const orchidORM = (_a, tables) => {
1369
1375
  options2.noPrimaryKey = "ignore";
1370
1376
  const dbTable = new Db(
1371
1377
  adapter,
1378
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1372
1379
  qb,
1373
1380
  table.table,
1374
1381
  table.columns.shape,
@@ -2124,7 +2131,9 @@ const getColumnMethodArgs = (t, to, key, dataType) => {
2124
2131
  if (!value)
2125
2132
  return;
2126
2133
  if (key === "indexes") {
2127
- return columnIndexesToCode(value);
2134
+ return columnIndexesToCode(
2135
+ value
2136
+ );
2128
2137
  }
2129
2138
  if (key === "foreignKeys") {
2130
2139
  return columnForeignKeysToCode(value);