@tstdl/base 0.92.95 → 0.92.96

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.
@@ -76,7 +76,7 @@ export declare class EntityRepository<T extends Entity | EntityWithoutMetadata =
76
76
  hardDeleteMany(ids: string[]): Promise<T[]>;
77
77
  hardDeleteManyByQuery(query: Query<T>): Promise<T[]>;
78
78
  getColumn(pathOrColumn: Paths<UntaggedDeep<T>> | ColumnDefinition): PgColumn;
79
- convertOrderBy(orderBy: Order<T>): SQL<unknown>[];
79
+ convertOrderBy(order: Order<T>): SQL[];
80
80
  convertQuery(query: Query<T>): SQL;
81
81
  mapManyToEntity(columns: InferSelect[]): Promise<T[]>;
82
82
  mapToEntity(columns: InferSelect): Promise<T>;
@@ -434,9 +434,9 @@ let EntityRepository = class EntityRepository {
434
434
  }
435
435
  return this.#table[pathOrColumn.name];
436
436
  }
437
- convertOrderBy(orderBy) {
438
- if (isArray(orderBy)) {
439
- return orderBy.map((item) => {
437
+ convertOrderBy(order) {
438
+ if (isArray(order)) {
439
+ return order.map((item) => {
440
440
  const itemIsArray = isArray(item);
441
441
  const target = itemIsArray ? item[0] : item;
442
442
  const column = isSQLWrapper(target) ? target : this.getColumn(target);
@@ -444,8 +444,11 @@ let EntityRepository = class EntityRepository {
444
444
  return direction == 'asc' ? asc(column) : desc(column);
445
445
  });
446
446
  }
447
- return objectEntries(orderBy)
448
- .map(([path, direction]) => {
447
+ if (isString(order)) {
448
+ const column = this.getColumn(order);
449
+ return [asc(column)];
450
+ }
451
+ return objectEntries(order).map(([path, direction]) => {
449
452
  const column = this.getColumn(path);
450
453
  return direction == 'asc' ? asc(column) : desc(column);
451
454
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.92.95",
3
+ "version": "0.92.96",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"