document-dataply 0.0.10-alpha.1 → 0.0.10-alpha.3

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/cjs/index.js CHANGED
@@ -10465,11 +10465,6 @@ var DocumentSerializeStrategyAsync = class extends import_dataply.SerializeStrat
10465
10465
  // src/core/bptree/documentComparator.ts
10466
10466
  var import_dataply2 = __toESM(require_cjs());
10467
10467
  var DocumentValueComparator = class extends import_dataply2.ValueComparator {
10468
- _intlComparator = new Intl.Collator(void 0, {
10469
- numeric: true,
10470
- sensitivity: "variant",
10471
- usage: "sort"
10472
- });
10473
10468
  primaryAsc(a, b) {
10474
10469
  return this._compareValue(a.v, b.v);
10475
10470
  }
@@ -10485,7 +10480,7 @@ var DocumentValueComparator = class extends import_dataply2.ValueComparator {
10485
10480
  */
10486
10481
  _compareDiff(a, b) {
10487
10482
  if (typeof a === "string" && typeof b === "string") {
10488
- return this._intlComparator.compare(a, b);
10483
+ return a.localeCompare(b);
10489
10484
  }
10490
10485
  return +a - +b;
10491
10486
  }
@@ -11099,6 +11094,7 @@ var DocumentDataplyAPI = class extends import_dataply3.DataplyAPI {
11099
11094
  pageSize: metadata.pageSize,
11100
11095
  pageCount: metadata.pageCount,
11101
11096
  rowCount: metadata.rowCount,
11097
+ usage: metadata.usage,
11102
11098
  indices,
11103
11099
  schemeVersion: innerMetadata.schemeVersion ?? 0
11104
11100
  };
@@ -11889,8 +11885,8 @@ var DocumentDataplyAPI = class extends import_dataply3.DataplyAPI {
11889
11885
  const isFts = ftsConditions.length > 0;
11890
11886
  const isCompositeVerify = compositeVerifyConditions.length > 0;
11891
11887
  const isVerifyOthers = verifyOthers.length > 0;
11892
- const isInfiniteLimit = isFinite(limit);
11893
- let currentChunkSize = isInfiniteLimit ? initialChunkSize : limit;
11888
+ const isFiniteLimit = isFinite(limit);
11889
+ let currentChunkSize = isFiniteLimit ? limit : initialChunkSize;
11894
11890
  let chunk = [];
11895
11891
  let chunkSize = 0;
11896
11892
  let dropped = 0;
@@ -11925,7 +11921,7 @@ var DocumentDataplyAPI = class extends import_dataply3.DataplyAPI {
11925
11921
  }
11926
11922
  docs.push(doc);
11927
11923
  }
11928
- if (isInfiniteLimit) {
11924
+ if (!isFiniteLimit) {
11929
11925
  currentChunkSize = this.adjustChunkSize(currentChunkSize, chunkTotalSize);
11930
11926
  }
11931
11927
  return docs;
@@ -1,7 +1,6 @@
1
1
  import type { DataplyTreeValue, Primitive } from '../../types';
2
2
  import { ValueComparator } from 'dataply';
3
3
  export declare class DocumentValueComparator<T extends DataplyTreeValue<U>, U extends Primitive> extends ValueComparator<T> {
4
- private readonly _intlComparator;
5
4
  primaryAsc(a: T, b: T): number;
6
5
  asc(a: T, b: T): number;
7
6
  match(value: T): string;
@@ -53,6 +53,11 @@ export interface DocumentDataplyMetadata {
53
53
  * The total number of data rows in the dataply.
54
54
  */
55
55
  rowCount: number;
56
+ /**
57
+ * The usage of the dataply. It is calculated based on the remaining page capacity.
58
+ * The value is between 0 and 1.
59
+ */
60
+ usage: number;
56
61
  /**
57
62
  * The list of user-created index names (excludes internal '_id' index).
58
63
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-dataply",
3
- "version": "0.0.10-alpha.1",
3
+ "version": "0.0.10-alpha.3",
4
4
  "description": "Simple and powerful JSON document database supporting complex queries and flexible indexing policies.",
5
5
  "license": "MIT",
6
6
  "author": "izure <admin@izure.org>",
@@ -51,4 +51,4 @@
51
51
  "ts-jest": "^29.4.6",
52
52
  "typescript": "^5.9.3"
53
53
  }
54
- }
54
+ }