jexidb 2.2.1 → 2.2.2

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
@@ -2652,6 +2652,27 @@ class IndexManager {
2652
2652
  this.markIndexUsed();
2653
2653
  }
2654
2654
 
2655
+ /**
2656
+ * Restored public API: return the indexed terms (keys) currently held in memory
2657
+ * for a given column.
2658
+ *
2659
+ * IMPORTANT: This method reads ONLY the in-memory index. It never triggers a lazy
2660
+ * reload and never performs any disk I/O. If the index was idle-unloaded
2661
+ * (`indexLoaded === false`), it returns an empty Set. Callers that need the
2662
+ * on-disk index after an unload must first ensure it is loaded again, e.g.
2663
+ * `await database._ensureLazyIndexLoaded()`.
2664
+ *
2665
+ * @param {string} column - Indexed field name (e.g. 'nameTerms', 'groupTerms', 'category')
2666
+ * @returns {Set<string>} Terms currently indexed for the column (empty Set if the
2667
+ * column is not indexed or the index is not loaded)
2668
+ */
2669
+ readColumnIndex(column) {
2670
+ if (!this.index || !this.index.data || !this.index.data[column]) {
2671
+ return new Set();
2672
+ }
2673
+ return new Set(Object.keys(this.index.data[column]));
2674
+ }
2675
+
2655
2676
  /**
2656
2677
  * Convert index to JSON-serializable format for debugging and export
2657
2678
  * This resolves the issue where Sets appear as empty objects in JSON.stringify
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jexidb",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
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",
@@ -2341,6 +2341,27 @@ export default class IndexManager {
2341
2341
  this.markIndexUsed()
2342
2342
  }
2343
2343
 
2344
+ /**
2345
+ * Restored public API: return the indexed terms (keys) currently held in memory
2346
+ * for a given column.
2347
+ *
2348
+ * IMPORTANT: This method reads ONLY the in-memory index. It never triggers a lazy
2349
+ * reload and never performs any disk I/O. If the index was idle-unloaded
2350
+ * (`indexLoaded === false`), it returns an empty Set. Callers that need the
2351
+ * on-disk index after an unload must first ensure it is loaded again, e.g.
2352
+ * `await database._ensureLazyIndexLoaded()`.
2353
+ *
2354
+ * @param {string} column - Indexed field name (e.g. 'nameTerms', 'groupTerms', 'category')
2355
+ * @returns {Set<string>} Terms currently indexed for the column (empty Set if the
2356
+ * column is not indexed or the index is not loaded)
2357
+ */
2358
+ readColumnIndex(column) {
2359
+ if (!this.index || !this.index.data || !this.index.data[column]) {
2360
+ return new Set()
2361
+ }
2362
+ return new Set(Object.keys(this.index.data[column]))
2363
+ }
2364
+
2344
2365
  /**
2345
2366
  * Convert index to JSON-serializable format for debugging and export
2346
2367
  * This resolves the issue where Sets appear as empty objects in JSON.stringify