befly 3.16.7 → 3.16.9

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/befly.js CHANGED
@@ -101,6 +101,22 @@ function isFiniteNumber(value) {
101
101
  function isIntegerNumber(value) {
102
102
  return typeof value === "number" && Number.isFinite(value) && Number.isInteger(value);
103
103
  }
104
+ function canConvertToNumber(value) {
105
+ const maxSafe = BigInt(Number.MAX_SAFE_INTEGER);
106
+ const minSafe = BigInt(Number.MIN_SAFE_INTEGER);
107
+ if (value > maxSafe || value < minSafe) {
108
+ return null;
109
+ }
110
+ const asNumber = Number(value);
111
+ if (!Number.isSafeInteger(asNumber)) {
112
+ return null;
113
+ }
114
+ const text = String(asNumber);
115
+ if (text.includes("e") || text.includes("E")) {
116
+ return null;
117
+ }
118
+ return asNumber;
119
+ }
104
120
  function formatValuePreview(value) {
105
121
  if (value === null) {
106
122
  return "null";
@@ -15480,8 +15496,9 @@ class DbHelper {
15480
15496
  }
15481
15497
  }
15482
15498
  if (bigintValue !== null) {
15483
- if (bigintValue <= MAX_SAFE_INTEGER_BIGINT && bigintValue >= MIN_SAFE_INTEGER_BIGINT) {
15484
- nextValue = Number(bigintValue);
15499
+ const convertedNumber = canConvertToNumber(bigintValue);
15500
+ if (convertedNumber !== null) {
15501
+ nextValue = convertedNumber;
15485
15502
  }
15486
15503
  }
15487
15504
  }
@@ -15697,6 +15714,13 @@ class DbHelper {
15697
15714
  const countExecRes = await this.executeSelect(countSql, countParams);
15698
15715
  const total = countExecRes.data?.[0]?.total || 0;
15699
15716
  if (total === 0) {
15717
+ const offset2 = (prepared.page - 1) * prepared.limit;
15718
+ const dataBuilder2 = this.createSqlBuilder().select(prepared.fields).from(prepared.table).where(whereFiltered).limit(prepared.limit).offset(offset2);
15719
+ this.applyJoins(dataBuilder2, prepared.joins);
15720
+ if (prepared.orderBy && prepared.orderBy.length > 0) {
15721
+ dataBuilder2.orderBy(prepared.orderBy);
15722
+ }
15723
+ const { sql: dataSql2, params: dataParams2 } = dataBuilder2.toSelectSql();
15700
15724
  return {
15701
15725
  data: {
15702
15726
  lists: [],
@@ -15706,7 +15730,12 @@ class DbHelper {
15706
15730
  pages: 0
15707
15731
  },
15708
15732
  sql: {
15709
- count: countExecRes.sql
15733
+ count: countExecRes.sql,
15734
+ data: {
15735
+ sql: dataSql2,
15736
+ params: dataParams2,
15737
+ duration: 0
15738
+ }
15710
15739
  }
15711
15740
  };
15712
15741
  }