metal-orm 1.0.78 → 1.0.79

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.cjs CHANGED
@@ -6595,10 +6595,8 @@ async function executePagedQuery(builder, session, options, countCallback) {
6595
6595
  throw new Error("executePaged: pageSize must be an integer >= 1");
6596
6596
  }
6597
6597
  const offset = (page - 1) * pageSize;
6598
- const [items, totalItems] = await Promise.all([
6599
- builder.limit(pageSize).offset(offset).execute(session),
6600
- countCallback(session)
6601
- ]);
6598
+ const totalItems = await countCallback(session);
6599
+ const items = await builder.limit(pageSize).offset(offset).execute(session);
6602
6600
  return { items, totalItems, page, pageSize };
6603
6601
  }
6604
6602
  function buildWhereHasPredicate(env, context, relationFacet, createChildBuilder, relationName, callbackOrOptions, maybeOptions, negate = false) {
@@ -7486,7 +7484,7 @@ var SelectQueryBuilder = class _SelectQueryBuilder {
7486
7484
  */
7487
7485
  async executePaged(session, options) {
7488
7486
  const builder = this.ensureDefaultSelection();
7489
- return executePagedQuery(builder, session, options, (sess) => this.count(sess));
7487
+ return executePagedQuery(builder, session, options, (sess) => builder.count(sess));
7490
7488
  }
7491
7489
  /**
7492
7490
  * Executes the query with provided execution and hydration contexts