jexidb 2.2.6 → 2.2.7

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/Database.cjs CHANGED
@@ -9563,6 +9563,11 @@ class Database extends events.EventEmitter {
9563
9563
  throw new Error('The "fields" option is mandatory and must be an object with at least one field definition. Example: { fields: { id: "number", name: "string" } }');
9564
9564
  }
9565
9565
 
9566
+ // Normalize the indexes option BEFORE term mapping detection: an indexes array
9567
+ // (e.g. ['nameTerms']) must become { nameTerms: 'array:string' } first, otherwise
9568
+ // auto-detection sees no 'array:string' entries and silently returns no fields.
9569
+ this.prepareIndexConfiguration();
9570
+
9566
9571
  // CRITICAL FIX: Initialize serializer first - this was missing and causing crashes
9567
9572
  this.serializer = new Serializer(this.opts);
9568
9573
 
@@ -9601,9 +9606,6 @@ class Database extends events.EventEmitter {
9601
9606
  }
9602
9607
  }
9603
9608
 
9604
- // Prepare index configuration for IndexManager
9605
- this.prepareIndexConfiguration();
9606
-
9607
9609
  // Validate configuration after conversion
9608
9610
  this.validateIndexConfiguration();
9609
9611
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jexidb",
3
- "version": "2.2.6",
3
+ "version": "2.2.7",
4
4
  "type": "module",
5
5
  "description": "JexiDB is a pure JS NPM library for managing data on disk efficiently, without the need for a server.",
6
6
  "main": "./dist/Database.cjs",
package/src/Database.mjs CHANGED
@@ -596,6 +596,11 @@ class Database extends EventEmitter {
596
596
  throw new Error('The "fields" option is mandatory and must be an object with at least one field definition. Example: { fields: { id: "number", name: "string" } }')
597
597
  }
598
598
 
599
+ // Normalize the indexes option BEFORE term mapping detection: an indexes array
600
+ // (e.g. ['nameTerms']) must become { nameTerms: 'array:string' } first, otherwise
601
+ // auto-detection sees no 'array:string' entries and silently returns no fields.
602
+ this.prepareIndexConfiguration()
603
+
599
604
  // CRITICAL FIX: Initialize serializer first - this was missing and causing crashes
600
605
  this.serializer = new Serializer(this.opts)
601
606
 
@@ -635,9 +640,6 @@ class Database extends EventEmitter {
635
640
  }
636
641
  }
637
642
 
638
- // Prepare index configuration for IndexManager
639
- this.prepareIndexConfiguration()
640
-
641
643
  // Validate configuration after conversion
642
644
  this.validateIndexConfiguration()
643
645