@devisfuture/mega-collection 1.1.0 → 1.1.1

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.
@@ -18,18 +18,45 @@ declare class FilterEngine<T extends CollectionItem> {
18
18
  private previousResult;
19
19
  private previousCriteria;
20
20
  private previousBaseData;
21
+ /**
22
+ * Creates a new FilterEngine with optional data and fields to index.
23
+ */
21
24
  constructor(options?: FilterEngineOptions<T>);
25
+ /**
26
+ * Builds an index for the given field.
27
+ */
22
28
  private buildIndex;
23
29
  clearIndexes(): void;
24
30
  resetFilterState(): void;
31
+ /**
32
+ * Filters the data based on the given criteria.
33
+ */
25
34
  filter(criteria: FilterCriterion<T>[]): T[];
26
35
  filter(data: T[], criteria: FilterCriterion<T>[]): T[];
27
36
  private cloneCriteria;
37
+ /**
38
+ * Checks if there are new criteria added.
39
+ */
28
40
  private hasCriteriaAdditions;
41
+ /**
42
+ * Checks if there are criteria removed.
43
+ */
29
44
  private hasCriteriaRemovals;
45
+ /**
46
+ * Gets the newly added criteria.
47
+ */
30
48
  private getAddedCriteria;
49
+ /**
50
+ * Filters data linearly without index.
51
+ */
31
52
  private linearFilter;
53
+ /**
54
+ * Filters data using the index.
55
+ */
32
56
  private filterViaIndex;
57
+ /**
58
+ * Estimates the size of the index for a criterion.
59
+ */
33
60
  private estimateIndexSize;
34
61
  }
35
62
 
@@ -21,11 +21,27 @@ interface MergeEnginesOptions<T extends CollectionItem> {
21
21
  }
22
22
  declare class MergeEngines<T extends CollectionItem> {
23
23
  private readonly engine;
24
+ /**
25
+ * Creates a new MergeEngines instance with the given options.
26
+ * Collects all modules from imports.
27
+ */
24
28
  constructor(options: MergeEnginesOptions<T>);
29
+ /**
30
+ * Gets the initialization options for a module.
31
+ */
25
32
  private getModuleInitOptions;
33
+ /**
34
+ * Gets the method names from a prototype.
35
+ */
26
36
  private getMethodNames;
37
+ /**
38
+ * Checks if an object has a specific method.
39
+ */
27
40
  private hasMethod;
28
41
  private isRecord;
42
+ /**
43
+ * Calls a method on the engine.
44
+ */
29
45
  private callEngineMethod;
30
46
  search(query: string): T[];
31
47
  search(field: keyof T & string, query: string): T[];
@@ -15,16 +15,40 @@ declare class TextSearchEngine<T extends CollectionItem> {
15
15
  private ngramIndexes;
16
16
  private data;
17
17
  private readonly minQueryLength;
18
+ /**
19
+ * Creates a new TextSearchEngine with optional data and fields to index.
20
+ */
18
21
  constructor(options?: TextSearchEngineOptions<T>);
22
+ /**
23
+ * Builds an n-gram index for the given field.
24
+ */
19
25
  private buildIndex;
20
26
  search(query: string): T[];
21
27
  search(field: keyof T & string, query: string): T[];
22
28
  private normalizeQuery;
29
+ /**
30
+ * Checks if the query is long enough to search.
31
+ */
23
32
  private isQuerySearchable;
33
+ /**
34
+ * Searches all indexed fields.
35
+ */
24
36
  private searchAllFields;
37
+ /**
38
+ * Searches a specific field.
39
+ */
25
40
  private searchField;
41
+ /**
42
+ * Searches a field using prepared query grams.
43
+ */
26
44
  private searchFieldWithPreparedQuery;
45
+ /**
46
+ * Searches all fields linearly without index.
47
+ */
27
48
  private searchAllFieldsLinear;
49
+ /**
50
+ * Searches a specific field linearly without index.
51
+ */
28
52
  private searchFieldLinear;
29
53
  clear(): void;
30
54
  }
@@ -13,14 +13,38 @@ interface SortEngineOptions<T extends CollectionItem = CollectionItem> {
13
13
  declare class SortEngine<T extends CollectionItem> {
14
14
  private cache;
15
15
  private data;
16
+ /**
17
+ * Creates a new SortEngine with optional data and fields to index.
18
+ */
16
19
  constructor(options?: SortEngineOptions<T>);
20
+ /**
21
+ * Builds an index for sorting the given field.
22
+ */
17
23
  private buildIndex;
24
+ /**
25
+ * Clears all cached indexes.
26
+ */
18
27
  clearIndexes(): void;
28
+ /**
29
+ * Sorts the data based on the given descriptors.
30
+ */
19
31
  sort(descriptors: SortDescriptor<T>[]): T[];
20
32
  sort(data: T[], descriptors: SortDescriptor<T>[], inPlace?: boolean): T[];
33
+ /**
34
+ * Reconstructs the sorted array from the cached index.
35
+ */
21
36
  private reconstructFromIndex;
37
+ /**
38
+ * Checks if the field snapshot is still valid.
39
+ */
22
40
  private isFieldSnapshotValid;
41
+ /**
42
+ * Builds a comparator function for sorting.
43
+ */
23
44
  private buildComparator;
45
+ /**
46
+ * Sorts numeric data using radix sort.
47
+ */
24
48
  private radixSortNumeric;
25
49
  }
26
50
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devisfuture/mega-collection",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "High-performance search, filter & sort engine for 100K+ item collections in JavaScript/TypeScript",
5
5
  "exports": {
6
6
  ".": {