orchid-orm 1.29.2 → 1.31.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 { makeColumnTypes, SqlMethod, QueryHooks, defaultSchemaConfig, getColumnTypes, parseTableData, _queryHookAfterCreate, _queryHookAfterUpdate, getQueryAs, setQueryObjectValue, pushQueryOn, VirtualColumn, pushQueryValue, _queryCreateMany, isQueryReturnsAll, _queryHookBeforeUpdate, _queryFindBy, _queryCreate, _queryRows, _queryUpdate, _queryDelete, _queryDefaults, _queryUpdateOrThrow, _queryWhere, toSQLCacheKey, _queryJoinOn, OrchidOrmInternalError, _queryCreateFrom, NotFoundError, _queryFindByOptional, _querySelect, _queryWhereExists, _queryTake, _queryTakeOptional, _queryAll, Adapter, _initQueryBuilder, Db, addComputedColumns, getClonedQueryData } from 'pqb';
1
+ import { makeColumnTypes, SqlMethod, QueryHooks, defaultSchemaConfig, getColumnTypes, parseTableData, _queryHookAfterCreate, _queryHookAfterUpdate, getQueryAs, setQueryObjectValue, pushQueryOn, VirtualColumn, pushQueryValue, _queryCreateMany, isQueryReturnsAll, _queryHookBeforeUpdate, _queryFindBy, _queryCreate, _queryRows, _queryUpdate, _queryDelete, _queryDefaults, _queryUpdateOrThrow, _queryWhere, toSQLCacheKey, _queryJoinOn, OrchidOrmInternalError, _queryCreateFrom, NotFoundError, _queryFindByOptional, _querySelect, _queryWhereExists, _queryTake, _queryTakeOptional, _queryAll, Adapter, _initQueryBuilder, Db, getClonedQueryData } from 'pqb';
2
2
  export * from 'pqb';
3
3
  import { getStackTrace, applyMixins, getCallerFilePath, snakeCaseKey, toSnakeCase, emptyObject, emptyArray, objectHasValues, toArray } from 'orchid-core';
4
4
  export * from 'orchid-core';
@@ -437,7 +437,10 @@ const nestedUpdate$3 = ({ query, primaryKeys, foreignKeys, len }) => {
437
437
  } else if (params.create) {
438
438
  const q3 = query.clone();
439
439
  q3.q.select = primaryKeys;
440
- const record = await _queryCreate(q3, params.create);
440
+ const record = await _queryCreate(
441
+ q3,
442
+ params.create
443
+ );
441
444
  for (let i = 0; i < len; i++) {
442
445
  update[foreignKeys[i]] = record[primaryKeys[i]];
443
446
  }
@@ -474,7 +477,10 @@ const nestedUpdate$3 = ({ query, primaryKeys, foreignKeys, len }) => {
474
477
  );
475
478
  } else {
476
479
  const data = typeof upsert.create === "function" ? upsert.create() : upsert.create;
477
- const result = await _queryCreate(query.select(...primaryKeys), data);
480
+ const result = await _queryCreate(
481
+ query.select(...primaryKeys),
482
+ data
483
+ );
478
484
  const collectData = {};
479
485
  state.collect = {
480
486
  keys: primaryKeys,
@@ -1885,7 +1891,8 @@ const orchidORM = (_a, tables) => {
1885
1891
  softDelete: table.softDelete,
1886
1892
  snakeCase: table.snakeCase,
1887
1893
  comment: table.comment,
1888
- noPrimaryKey: table.noPrimaryKey ? "ignore" : void 0
1894
+ noPrimaryKey: table.noPrimaryKey ? "ignore" : void 0,
1895
+ computed: table.computed
1889
1896
  });
1890
1897
  const dbTable = new Db(
1891
1898
  adapter,
@@ -1902,12 +1909,6 @@ const orchidORM = (_a, tables) => {
1902
1909
  dbTable.db = result;
1903
1910
  dbTable.filePath = table.filePath;
1904
1911
  dbTable.name = table.constructor.name;
1905
- if (table.computed) {
1906
- addComputedColumns(
1907
- dbTable,
1908
- table.computed
1909
- );
1910
- }
1911
1912
  result[key] = dbTable;
1912
1913
  }
1913
1914
  applyRelations(qb, tableInstances, result);