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.js CHANGED
@@ -6319,10 +6319,8 @@ async function executePagedQuery(builder, session, options, countCallback) {
6319
6319
  throw new Error("executePaged: pageSize must be an integer >= 1");
6320
6320
  }
6321
6321
  const offset = (page - 1) * pageSize;
6322
- const [items, totalItems] = await Promise.all([
6323
- builder.limit(pageSize).offset(offset).execute(session),
6324
- countCallback(session)
6325
- ]);
6322
+ const totalItems = await countCallback(session);
6323
+ const items = await builder.limit(pageSize).offset(offset).execute(session);
6326
6324
  return { items, totalItems, page, pageSize };
6327
6325
  }
6328
6326
  function buildWhereHasPredicate(env, context, relationFacet, createChildBuilder, relationName, callbackOrOptions, maybeOptions, negate = false) {
@@ -7210,7 +7208,7 @@ var SelectQueryBuilder = class _SelectQueryBuilder {
7210
7208
  */
7211
7209
  async executePaged(session, options) {
7212
7210
  const builder = this.ensureDefaultSelection();
7213
- return executePagedQuery(builder, session, options, (sess) => this.count(sess));
7211
+ return executePagedQuery(builder, session, options, (sess) => builder.count(sess));
7214
7212
  }
7215
7213
  /**
7216
7214
  * Executes the query with provided execution and hydration contexts