orchid-orm 1.13.8 → 1.14.0

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
@@ -1,4 +1,4 @@
1
- import { columnTypes, QueryHooks, getColumnTypes, addQueryOn, VirtualColumn, pushQueryValue, isQueryReturnsAll, getQueryAs, toSqlCacheKey, OrchidOrmInternalError, NotFoundError, relationQueryKey, Adapter, Db, anyShape, getClonedQueryData } from 'pqb';
1
+ import { columnTypes, QueryHooks, getColumnTypes, addQueryOn, VirtualColumn, pushQueryValue, isQueryReturnsAll, getQueryAs, toSQLCacheKey, OrchidOrmInternalError, NotFoundError, relationQueryKey, Adapter, Db, anyShape, getClonedQueryData } from 'pqb';
2
2
  export { OrchidOrmError, OrchidOrmInternalError, columnTypes, raw, testTransaction } from 'pqb';
3
3
  import { getStackTrace, applyMixins, getCallerFilePath, snakeCaseKey, toSnakeCase } from 'orchid-core';
4
4
  import { AsyncLocalStorage } from 'node:async_hooks';
@@ -757,7 +757,7 @@ const nestedUpdate$1 = ({ query, primaryKey, foreignKey }) => {
757
757
  [foreignKey]: data[0][primaryKey]
758
758
  }))
759
759
  );
760
- delete t.q[toSqlCacheKey];
760
+ delete t.q[toSQLCacheKey];
761
761
  }
762
762
  if (params.disconnect || params.set) {
763
763
  await t.where(
@@ -769,7 +769,7 @@ const nestedUpdate$1 = ({ query, primaryKey, foreignKey }) => {
769
769
  )
770
770
  )._update({ [foreignKey]: null });
771
771
  if (params.set) {
772
- delete t.q[toSqlCacheKey];
772
+ delete t.q[toSQLCacheKey];
773
773
  await t.where(
774
774
  Array.isArray(params.set) ? {
775
775
  OR: params.set
@@ -778,7 +778,7 @@ const nestedUpdate$1 = ({ query, primaryKey, foreignKey }) => {
778
778
  }
779
779
  }
780
780
  if (params.delete || params.update) {
781
- delete t.q[toSqlCacheKey];
781
+ delete t.q[toSQLCacheKey];
782
782
  const q = t._where(
783
783
  getWhereForNestedUpdate(
784
784
  data,
@@ -1124,7 +1124,7 @@ const nestedUpdate = (state) => {
1124
1124
  if (params.set) {
1125
1125
  const j = queryJoinTable(state, data);
1126
1126
  await j._delete();
1127
- delete j.q[toSqlCacheKey];
1127
+ delete j.q[toSQLCacheKey];
1128
1128
  const ids = await queryRelatedTable(
1129
1129
  state.relatedTableQuery,
1130
1130
  params.set
@@ -1309,6 +1309,7 @@ const applyRelation = (qb, { relationName, relation, dbTable, otherDbTable }, de
1309
1309
  };
1310
1310
  const makeRelationQuery = (table, relationName, data, q) => {
1311
1311
  Object.defineProperty(table, relationName, {
1312
+ configurable: true,
1312
1313
  get() {
1313
1314
  var _a;
1314
1315
  const toTable = q.clone();
@@ -1332,6 +1333,11 @@ const makeRelationQuery = (table, relationName, data, q) => {
1332
1333
  return query[prop];
1333
1334
  }
1334
1335
  });
1336
+ },
1337
+ set(value) {
1338
+ Object.defineProperty(this, relationName, {
1339
+ value
1340
+ });
1335
1341
  }
1336
1342
  });
1337
1343
  };