@devisfuture/mega-collection 2.4.7 → 2.4.8

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.
Files changed (66) hide show
  1. package/dist/{State.d.ts → State-CYIe-3He.d.ts} +5 -3
  2. package/dist/chunks/constants-BXQI1M5E.mjs +1 -0
  3. package/dist/chunks/internal-COJC3Ik3.mjs +1 -0
  4. package/dist/chunks/merge-BRXHTBZ0.mjs +1 -0
  5. package/dist/filter/index.d.ts +111 -4
  6. package/dist/filter/index.mjs +1 -2
  7. package/dist/index.d.ts +2 -4
  8. package/dist/index.mjs +1 -2
  9. package/dist/merge/index.d.ts +128 -4
  10. package/dist/merge/index.mjs +1 -2
  11. package/dist/search/index.d.ts +190 -4
  12. package/dist/search/index.mjs +1 -2
  13. package/dist/sort/index.d.ts +55 -4
  14. package/dist/sort/index.mjs +1 -2
  15. package/dist/types-DONld7xY.d.ts +74 -0
  16. package/package.json +5 -2
  17. package/dist/State.mjs +0 -183
  18. package/dist/constants.d.ts +0 -5
  19. package/dist/constants.mjs +0 -4
  20. package/dist/filter/chain.d.ts +0 -9
  21. package/dist/filter/chain.mjs +0 -22
  22. package/dist/filter/constants.d.ts +0 -2
  23. package/dist/filter/criterion.d.ts +0 -6
  24. package/dist/filter/criterion.mjs +0 -64
  25. package/dist/filter/errors.d.ts +0 -7
  26. package/dist/filter/errors.mjs +0 -17
  27. package/dist/filter/filter.d.ts +0 -89
  28. package/dist/filter/filter.mjs +0 -439
  29. package/dist/filter/nested.d.ts +0 -32
  30. package/dist/filter/nested.mjs +0 -246
  31. package/dist/filter/types.d.ts +0 -74
  32. package/dist/filter/utils.d.ts +0 -4
  33. package/dist/filter/utils.mjs +0 -29
  34. package/dist/indexer.d.ts +0 -41
  35. package/dist/indexer.mjs +0 -101
  36. package/dist/internal.d.ts +0 -6
  37. package/dist/internal.mjs +0 -18
  38. package/dist/merge/chain.d.ts +0 -9
  39. package/dist/merge/chain.mjs +0 -23
  40. package/dist/merge/constants.d.ts +0 -6
  41. package/dist/merge/constants.mjs +0 -8
  42. package/dist/merge/errors.d.ts +0 -8
  43. package/dist/merge/errors.mjs +0 -19
  44. package/dist/merge/merge-engines.d.ts +0 -75
  45. package/dist/merge/merge-engines.mjs +0 -432
  46. package/dist/merge/module-adapters.d.ts +0 -7
  47. package/dist/merge/module-adapters.mjs +0 -41
  48. package/dist/merge/types.d.ts +0 -125
  49. package/dist/search/constants.d.ts +0 -5
  50. package/dist/search/nested.d.ts +0 -41
  51. package/dist/search/nested.mjs +0 -210
  52. package/dist/search/ngram.d.ts +0 -23
  53. package/dist/search/ngram.mjs +0 -96
  54. package/dist/search/text-search.d.ts +0 -146
  55. package/dist/search/text-search.mjs +0 -696
  56. package/dist/search/types.d.ts +0 -93
  57. package/dist/search/utils.d.ts +0 -4
  58. package/dist/search/utils.mjs +0 -22
  59. package/dist/sort/errors.d.ts +0 -5
  60. package/dist/sort/errors.mjs +0 -11
  61. package/dist/sort/sorter.d.ts +0 -47
  62. package/dist/sort/sorter.mjs +0 -375
  63. package/dist/sort/types.d.ts +0 -18
  64. package/dist/sort/utils.d.ts +0 -17
  65. package/dist/sort/utils.mjs +0 -38
  66. package/dist/types.d.ts +0 -73
@@ -1,2 +1 @@
1
- import { TextSearchEngine as e } from "./text-search.mjs";
2
- export { e as TextSearchEngine };
1
+ import{a as e,i as t,n as s}from"../chunks/constants-BXQI1M5E.mjs";import{n as i}from"../chunks/internal-COJC3Ik3.mjs";function n(e,t,s,i){const n=function(e,t){const s=[];for(const i of t){const t=e.get(i);if(!t)return null;s.push(t)}return function(e){for(let t=0;t<e.length-1;t++){let s=t;for(let i=t+1;i<e.length;i++)e[i].size<e[s].size&&(s=i);if(s!==t){const i=e[t];e[t]=e[s],e[s]=i}}}(s),s}(e,t);if(null===n)return null;const r=n[0];return{smallestPostingList:r,matches:e=>r.has(e)&&function(e,t){for(let s=0;s<t.length;s++)if(!t[s].has(e))return!1;return!0}(e,n)&&Boolean(s[e]?.includes(i))}}function r(e,t){const s=e.get(t);if(s)return s;const i=/* @__PURE__ */new Set;return e.set(t,i),i}function l(e,t,s){const i=Math.min(3,t.length);for(let n=2;n<=i;n++){const i=t.length-n;for(let l=0;l<=i;l++)r(e,t.substring(l,l+n)).add(s)}}function a(e,t,s,i,r={}){const{restrictionLookup:l=null,take:a=Number.POSITIVE_INFINITY}=r,o=n(e,t,s,i);if(null===o)return[];const d=[];for(const n of o.smallestPostingList)if((null===l||l[n])&&o.matches(n)&&(d.push(n),d.length>=a))break;return d}function o(e,t,s,i,r){const{candidateIndices:l,restrictionLookup:a=null,take:o=Number.POSITIVE_INFINITY}=r;if(0===l.length)return[];const d=n(e,t,s,i);if(null===d)return[];const h=[];if(null===a||l.length<=d.smallestPostingList.size){for(let e=0;e<l.length;e++){const t=l[e];if(d.matches(t)&&(h.push(t),h.length>=o))break}return h}for(const n of d.smallestPostingList)if(a[n]&&d.matches(n)&&(h.push(n),h.length>=o))break;return h}function d(e,t,s){const i=Math.min(3,t.length);for(let n=2;n<=i;n++){const i=t.length-n;for(let r=0;r<=i;r++){const i=t.substring(r,r+n),l=e.get(i);l&&(l.delete(s),0===l.size&&e.delete(i))}}}var h=class{constructor(e={ngramIndexes:/* @__PURE__ */new Map,normalizedFieldValues:/* @__PURE__ */new Map}){this.storage=e,this.registeredFields=/* @__PURE__ */new Set,this.fieldDescriptors=/* @__PURE__ */new Map}registerFields(e){if(e?.length)for(const t of e)this.registerField(t)}hasRegisteredFields(){return this.registeredFields.size>0}hasField(e){return this.registeredFields.has(e)}hasIndexes(){return this.storage.ngramIndexes.size>0}clearIndexes(){this.storage.ngramIndexes.clear(),this.storage.normalizedFieldValues.clear()}buildIndexes(e){this.clearIndexes();for(const t of this.registeredFields)this.buildIndex(e,t)}addItems(e,t){if(0!==e.length&&0!==this.storage.ngramIndexes.size)for(const s of this.storage.ngramIndexes.keys())this.addItemsToField(s,e,t)}updateItem(e,t,s){if(0!==this.storage.ngramIndexes.size)for(const i of this.storage.ngramIndexes.keys())this.updateItemInField(i,e,t,s)}removeItem(e,t){if(0!==this.storage.ngramIndexes.size)for(const s of this.storage.ngramIndexes.keys())this.removeItemFromField(s,e,t)}moveItem(e,t,s){if(0!==this.storage.ngramIndexes.size&&t!==s)for(const i of this.storage.ngramIndexes.keys())this.moveItemForField(i,e,t,s)}searchAllIndexedFieldIndices(e,t,s,i){const n=/* @__PURE__ */new Set,r=[];for(const l of this.storage.ngramIndexes.keys())for(const a of this.searchIndexedFieldIndices(l,e,t,s,i))n.has(a)||(n.add(a),r.push(a));return r}searchIndexedField(e,t,s,i,n,r,l=Number.POSITIVE_INFINITY){const a=this.searchIndexedFieldIndices(t,s,i,n,r,l),o=[];for(let d=0;d<a.length;d++){const t=e[a[d]];t&&o.push(t)}return o}searchIndexedFieldIndices(e,t,s,i,n,r=Number.POSITIVE_INFINITY){const l=this.storage.ngramIndexes.get(e);if(!l)return[];const d=this.storage.normalizedFieldValues.get(e)??[];return null!=n?o(l,s,d,t,{candidateIndices:n,restrictionLookup:i,take:r}):a(l,s,d,t,{restrictionLookup:i,take:r})}searchFieldLinear(e,t,s){const i=this.searchFieldLinearIndices(e,t,s),n=[];for(let r=0;r<i.length;r++){const t=e[i[r]];t&&n.push(t)}return n}searchFieldLinearIndices(e,t,s,i){const n=this.fieldDescriptors.get(t);if(!n)return[];const{collectionKey:r,nestedKey:l}=n,a=[];if(i){for(let t=0;t<i.length;t++){const n=i[t],o=e[n][r];if(!Array.isArray(o))continue;let d=!1;for(let e=0;e<o.length;e++){const t=o[e][l];if("string"==typeof t&&t.toLowerCase().includes(s)){d=!0;break}}d&&a.push(n)}return a}for(let o=0;o<e.length;o++){const t=e[o][r];if(!Array.isArray(t))continue;let i=!1;for(let e=0;e<t.length;e++){const n=t[e][l];if("string"==typeof n&&n.toLowerCase().includes(s)){i=!0;break}}i&&a.push(o)}return a}matchesAnyField(e,t){for(const s of this.registeredFields){const i=this.fieldDescriptors.get(s);if(!i)continue;const{collectionKey:n,nestedKey:r}=i,l=e[n];if(Array.isArray(l))for(let e=0;e<l.length;e++){const s=l[e][r];if("string"==typeof s&&s.toLowerCase().includes(t))return!0}}return!1}registerField(e){const t=i(e);t&&(this.registeredFields.add(e),this.fieldDescriptors.set(e,t))}getNormalizedValues(e){const t=this.storage.normalizedFieldValues.get(e);if(t)return t;const s=[];return this.storage.normalizedFieldValues.set(e,s),s}buildIndex(e,t){const s=this.fieldDescriptors.get(t);if(!s)return;const{collectionKey:i,nestedKey:n}=s,r=/* @__PURE__ */new Map,a=new Array(e.length);for(let o=0,d=e.length;o<d;o++){const t=e[o][i];if(!Array.isArray(t))continue;const s=[];for(let e=0;e<t.length;e++){const i=t[e][n];"string"==typeof i&&s.push(i.toLowerCase())}if(0===s.length)continue;const d=s.join("\n");a[o]=d,l(r,d,o)}this.storage.ngramIndexes.set(t,r),this.storage.normalizedFieldValues.set(t,a)}addItemsToField(e,t,s){const i=this.fieldDescriptors.get(e),n=this.storage.ngramIndexes.get(e);if(!i||!n)return;const r=this.getNormalizedValues(e),{collectionKey:a,nestedKey:o}=i;for(let d=0;d<t.length;d++){const e=t[d][a];if(!Array.isArray(e))continue;const i=[],h=s+d;for(let t=0;t<e.length;t++){const s=e[t][o];"string"==typeof s&&i.push(s.toLowerCase())}if(0===i.length)continue;const u=i.join("\n");r[h]=u,l(n,u,h)}}updateItemInField(e,t,s,i){const n=this.storage.ngramIndexes.get(e);if(!n)return;const r=this.getNormalizedValues(e),a=this.getNormalizedItemValue(e,s),o=this.getNormalizedItemValue(e,t);a!==o&&(a&&d(n,a,i),o?(r[i]=o,l(n,o,i)):delete r[i])}removeItemFromField(e,t,s){const i=this.storage.ngramIndexes.get(e);if(!i)return;const n=this.getNormalizedValues(e),r=n[s]??this.getNormalizedItemValue(e,t);r&&d(i,r,s),delete n[s]}moveItemForField(e,t,s,i){const n=this.storage.ngramIndexes.get(e);if(!n)return;const r=this.getNormalizedValues(e),a=r[s]??this.getNormalizedItemValue(e,t);a?(d(n,a,s),l(n,a,i),r[i]=a,delete r[s]):delete r[s]}getNormalizedItemValue(e,t){const s=this.fieldDescriptors.get(e);if(!s)return null;const{collectionKey:i,nestedKey:n}=s,r=t[i];if(!Array.isArray(r))return null;const l=[];for(let a=0;a<r.length;a++){const e=r[a][n];"string"==typeof e&&l.push(e.toLowerCase())}return 0===l.length?null:l.join("\n")}},u=()=>({indexedFields:/* @__PURE__ */new Set,flatIndexes:/* @__PURE__ */new Map,nestedStorage:{ngramIndexes:/* @__PURE__ */new Map,normalizedFieldValues:/* @__PURE__ */new Map},deferredMutationVersion:null,filterByPreviousResult:!1,previousResultIndices:null,previousResultLookup:null,previousQuery:null,stats:{totalQueries:0,indexedQueries:0,fallbackQueries:0,fallbackFields:/* @__PURE__ */new Map}}),c=class{constructor(t={}){this.cachedIndexedFieldsList=null,this.cachedLinearSearchFieldsList=null,this.emittedWarningKeys=/* @__PURE__ */new Set,this.warnings=[],this.normalizedValuesCache=/* @__PURE__ */new Map,this.combinedNormalizedValuesCache=null,this.minQueryLength=t.minQueryLength??1,this.silent=t.silent??!1,this.state=t.state??new e(t.data??[]),this.namespace=this.state.createNamespace("search"),this.nestedCollection=new h(this.runtime.nestedStorage),this.nestedCollection.registerFields(t.nestedFields),this.state.subscribe(e=>this.handleStateMutation(e)),t.filterByPreviousResult&&(this.runtime.filterByPreviousResult=!0);const s=t.fields?.length,i=this.nestedCollection.hasRegisteredFields();if(s)for(const e of t.fields)this.indexedFields.add(e);this.dataset.length>0&&(s||i)&&this.rebuildConfiguredIndexes()}get dataset(){return this.state.getOriginData()}get runtime(){return this.state.getOrCreateScopedValue(this.namespace,"runtime",u)}get flatIndexes(){return this.runtime.flatIndexes}get indexedFields(){return this.runtime.indexedFields}shouldDeferMutationIndexUpdates(){return!0===this.state.getScopedValue(t,s)}markDeferredMutationState(){this.runtime.deferredMutationVersion=this.state.getMutationVersion(),this.flatIndexes.clear(),this.nestedCollection.clearIndexes(),this.cachedIndexedFieldsList=null,this.cachedLinearSearchFieldsList=null,this.normalizedValuesCache.clear(),this.combinedNormalizedValuesCache=null,this.clearPreviousSearchState()}ensureConfiguredIndexesReady(){null!==this.runtime.deferredMutationVersion&&(this.runtime.deferredMutationVersion=null,this.dataset.length>0&&(this.indexedFields.size>0||this.nestedCollection.hasRegisteredFields())&&this.rebuildConfiguredIndexes())}rebuildConfiguredIndexes(){this.flatIndexes.clear(),this.nestedCollection.clearIndexes(),this.cachedIndexedFieldsList=null,this.cachedLinearSearchFieldsList=null,this.normalizedValuesCache.clear(),this.combinedNormalizedValuesCache=null;for(const e of this.indexedFields)this.buildIndexFromData(this.dataset,e);this.nestedCollection.hasRegisteredFields()&&this.nestedCollection.buildIndexes(this.dataset)}buildIndexFromData(e,t){const s=this.state.getMutationVersion(),i=/* @__PURE__ */new Map,n=new Array(e.length);for(let r=0,a=e.length;r<a;r++){const s=e[r][t];if("string"!=typeof s)continue;const a=s.toLowerCase();n[r]=a,l(i,a,r)}this.flatIndexes.set(t,{ngramMap:i,normalizedValues:n,version:s})}search(e,t,s){return"string"==typeof t?this.searchField(e,t,s):this.searchAll(e,t)}searchAll(e,t){return this.searchAllFields(e,t)}normalizeQuery(e){return e.trim().toLowerCase()}normalizeSearchWindow(e){const t=Math.max(0,Math.trunc(e?.offset??0)),s=e?.limit,i=void 0===s?Number.POSITIVE_INFINITY:Math.max(0,Math.trunc(s));return{offset:t,limit:i,take:Number.isFinite(i)?t+i:Number.POSITIVE_INFINITY,hasWindow:t>0||Number.isFinite(i)}}shouldTrackPreviousResult(e){return!e.hasWindow}hasReachedWindowLimit(e,t){return Number.isFinite(e.limit)&&t>=e.limit}sliceItems(e,t){return t.hasWindow?e.slice(t.offset,t.take):e}collectItemsFromIndices(e,t){const s=t.hasWindow&&e.length>0?e.slice(t.offset,t.take):e,i=[];for(let n=0;n<s.length;n++){const e=this.dataset[s[n]];e&&i.push(e)}return{items:i,indices:s}}createLookup(e){const t=new Uint8Array(this.dataset.length);for(let s=0;s<e.length;s++)t[e[s]]=1;return t}getRestrictionLookup(e){const t=this.runtime.previousResultLookup;if(null!==t&&this.runtime.previousResultIndices===e&&t.length===this.dataset.length)return t;const s=this.createLookup(e);return this.runtime.previousResultLookup=s,s}getSearchSource(e){const{runtime:t}=this;return t.filterByPreviousResult?null!==t.previousQuery&&null!==t.previousResultIndices&&e.includes(t.previousQuery)?{indices:t.previousResultIndices,lookup:this.getRestrictionLookup(t.previousResultIndices)}:(t.previousResultIndices=null,t.previousResultLookup=null,t.previousQuery=null,{indices:null,lookup:null}):{indices:null,lookup:null}}saveSearchResult(e,t){const{runtime:s}=this;s.filterByPreviousResult&&(s.previousResultIndices=e,s.previousResultLookup=null,s.previousQuery=t)}persistSearchResult(e,t,s){s&&this.saveSearchResult(e.indices,t)}resetSearchState(){return this.clearPreviousSearchState(),this}getWarnings(){return[...this.warnings]}getStats(){const{totalQueries:e,indexedQueries:t,fallbackQueries:s,fallbackFields:i}=this.runtime.stats;return{totalQueries:e,indexedQueries:t,fallbackQueries:s,fallbackRate:0===e?0:s/e,fallbackFields:Object.fromEntries(i)}}resetStats(){const{stats:e}=this.runtime;return e.totalQueries=0,e.indexedQueries=0,e.fallbackQueries=0,e.fallbackFields.clear(),this}clearPreviousSearchState(){const{runtime:e}=this;e.previousResultIndices=null,e.previousResultLookup=null,e.previousQuery=null}recordIndexedQuery(){const{stats:e}=this.runtime;e.totalQueries+=1,e.indexedQueries+=1}recordFallbackQuery(e){const{stats:t}=this.runtime;t.totalQueries+=1,t.fallbackQueries+=1,t.fallbackFields.set(e,(t.fallbackFields.get(e)??0)+1)}shouldEmitFallbackWarning(e){return!this.silent&&e.length>=2}warnAboutFallback(e,t,s){if(!this.shouldEmitFallbackWarning(t))return;const i=`${e}\0${t}\0${s}`;if(this.emittedWarningKeys.has(i))return;this.emittedWarningKeys.add(i);const n=`[TextSearchEngine] warn: query "${t}" on ${e} used linear fallback. ${s}. Add the field(s) to the index schema to enable indexed search.`;this.warnings.push(n),"undefined"!=typeof process&&"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&console.warn(n)}getResolvedFlatIndex(e){const t=this.state.getMutationVersion();let s=this.flatIndexes.get(e);return s&&s.version!==t&&this.dataset.length>0&&(this.buildIndexFromData(this.dataset,e),s=this.flatIndexes.get(e)),s}getQueryGrams(e){const t=function(e){const t=function(e){const t=Math.min(3,Math.max(2,e.length)),s=e.length-t+1,i=new Array(s);for(let n=0;n<s;n++)i[n]=e.substring(n,n+t);return i}(e);if(t.length<=12)return new Set(t);const s=/* @__PURE__ */new Set,i=t.length-1;for(let n=0;n<=11;n++){const e=Math.round(n*i/11);s.add(t[e])}return s}(e);return t.size>0?t:null}searchAllFields(e,t){const s=this.normalizeQuery(e),i=this.normalizeSearchWindow(t),n="all fields";if(0===i.limit)return[];if(!s||s.length<this.minQueryLength)return this.sliceItems(this.dataset,i);s.length>=2&&this.ensureConfiguredIndexesReady();const r=this.shouldTrackPreviousResult(i),{indices:l,lookup:a}=this.getSearchSource(s);let o;const d=()=>(void 0!==o||(o=s.length>=2?this.getQueryGrams(s):null),o);if(null!==l){const e=d();if(null!==e&&(this.flatIndexes.size>0||this.nestedCollection.hasIndexes())){this.recordIndexedQuery();const t=this.searchAllFieldsIndexed(s,e,i,a,l);return this.persistSearchResult(t,s,r),t.items}this.recordFallbackQuery(n);const t=this.searchLinearAllFields(this.dataset,s,l,i);return this.persistSearchResult(t,s,r),t.items}if(!this.flatIndexes.size&&!this.nestedCollection.hasIndexes()){this.warnAboutFallback(n,s,this.indexedFields.size>0?"configured indexes are not currently built":"no indexed fields are configured"),this.recordFallbackQuery(n);const e=this.searchLinearAllFields(this.dataset,s,null,i);return this.persistSearchResult(e,s,r),e.items}const h=d();if(null===h){this.recordFallbackQuery(n);const e=this.searchLinearAllFields(this.dataset,s,null,i);return this.persistSearchResult(e,s,r),e.items}this.recordIndexedQuery();const u=this.searchAllFieldsIndexed(s,h,i,null);return this.persistSearchResult(u,s,r),u.items}searchAllFieldsIndexed(e,t,s,i,n=null){if(null!==n&&!this.nestedCollection.hasRegisteredFields()&&this.flatIndexes.size>0)return this.searchAllFieldsIndexedInCandidates(e,t,s,i,n);const r=this.dataset,l=new Uint8Array(r.length),a=[];let o=0;for(const d of this.flatIndexes.keys()){const r=this.searchFieldWithPreparedQueryIndices(d,e,t,i,n);for(let e=0;e<r.length;e++){const t=r[e];if(!l[t])if(l[t]=1,o<s.offset)o+=1;else if(a.push(t),o+=1,this.hasReachedWindowLimit(s,a.length))return this.materializeIndicesResult(a)}}for(const d of this.nestedCollection.searchAllIndexedFieldIndices(e,t,i,n))if(!l[d])if(l[d]=1,o<s.offset)o+=1;else if(a.push(d),o+=1,this.hasReachedWindowLimit(s,a.length))return this.materializeIndicesResult(a);return this.materializeIndicesResult(a)}searchAllFieldsIndexedInCandidates(e,t,s,i,r){const l=[];for(const d of this.flatIndexes.keys()){const s=this.getResolvedFlatIndex(d);if(!s)continue;const i=n(s.ngramMap,t,s.normalizedValues,e);null!==i&&l.push(i.matches)}if(0===l.length)return{items:[],indices:[]};const a=[];let o=0;for(let n=0;n<r.length;n++){const e=r[n];if(null!==i&&!i[e])continue;let t=!1;for(let s=0;s<l.length;s++)if(l[s](e)){t=!0;break}if(t)if(o<s.offset)o+=1;else if(a.push(e),o+=1,this.hasReachedWindowLimit(s,a.length))break}return this.materializeIndicesResult(a)}searchField(e,t,s){const i=this.normalizeQuery(t),n=this.normalizeSearchWindow(s),r=`field "${e}"`;if(0===n.limit)return[];if(!i||i.length<this.minQueryLength)return this.sliceItems(this.dataset,n);i.length>=2&&this.ensureConfiguredIndexesReady();const l=this.shouldTrackPreviousResult(n),{indices:a,lookup:o}=this.getSearchSource(i),d=this.nestedCollection.hasField(e);let h;const u=()=>(void 0!==h||(h=i.length>=2?this.getQueryGrams(i):null),h);if(null!==a){const t=u();if(d){if(null!==t&&this.nestedCollection.hasIndexes()){this.recordIndexedQuery();const s=this.nestedCollection.searchIndexedFieldIndices(e,i,t,o,a,n.take),r=this.collectItemsFromIndices(s,n);return this.persistSearchResult(r,i,l),r.items}this.recordFallbackQuery(r);const s=this.searchLinearSingleField(this.dataset,e,i,a,n);return this.persistSearchResult(s,i,l),s.items}if(null!==t&&this.flatIndexes.has(e)){this.recordIndexedQuery();const s=this.searchFieldWithPreparedQuery(e,i,t,n,o,a);return this.persistSearchResult(s,i,l),s.items}this.recordFallbackQuery(r);const s=this.searchLinearSingleField(this.dataset,e,i,a,n);return this.persistSearchResult(s,i,l),s.items}if(d){if(i.length>=2&&this.nestedCollection.hasIndexes()){const t=this.getQueryGrams(i);if(null===t)return[];this.recordIndexedQuery();const s=this.nestedCollection.searchIndexedFieldIndices(e,i,t,null,null,n.take),r=this.collectItemsFromIndices(s,n);return this.persistSearchResult(r,i,l),r.items}this.recordFallbackQuery(r);const t=this.searchLinearSingleField(this.dataset,e,i,null,n);return this.persistSearchResult(t,i,l),t.items}this.flatIndexes.size||this.warnAboutFallback(r,i,this.indexedFields.size>0?`field "${e}" is not backed by an active index`:"no indexed fields are configured");const c=u();if(this.flatIndexes.size>0&&null!==c){if(!this.flatIndexes.has(e))return[];this.recordIndexedQuery();const t=this.searchFieldWithPreparedQuery(e,i,c,n);return this.persistSearchResult(t,i,l),t.items}this.recordFallbackQuery(r);const f=this.searchLinearSingleField(this.dataset,e,i,null,n);return this.persistSearchResult(f,i,l),f.items}searchFieldWithPreparedQuery(e,t,s,i,n=null,r=null){const l=this.searchFieldWithPreparedQueryIndices(e,t,s,n,r,i.take);return this.collectItemsFromIndices(l,i)}searchFieldWithPreparedQueryIndices(e,t,s,i=null,n=null,r=Number.POSITIVE_INFINITY){const l=this.getResolvedFlatIndex(e);if(!l)return[];const{ngramMap:d,normalizedValues:h}=l;return null!==n?o(d,s,h,t,{candidateIndices:n,restrictionLookup:i,take:r}):a(d,s,h,t,{restrictionLookup:i,take:r})}getIndexedFieldsList(){return null===this.cachedIndexedFieldsList&&(this.cachedIndexedFieldsList=Array.from(this.indexedFields)),this.cachedIndexedFieldsList}materializeIndicesResult(e){const t=[];for(let s=0;s<e.length;s++){const i=this.dataset[e[s]];i&&t.push(i)}return{items:t,indices:e}}getLinearSearchFields(e){const t=this.getIndexedFieldsList();return t.length>0?t:(null!==this.cachedLinearSearchFieldsList||(this.cachedLinearSearchFieldsList=e.length?Object.keys(e[0]).filter(t=>"string"==typeof e[0][t]):[]),this.cachedLinearSearchFieldsList)}buildNormalizedValuesOnly(e,t){const s=new Array(e.length);for(let i=0,n=e.length;i<n;i++){const n=e[i][t];"string"==typeof n&&(s[i]=n.toLowerCase())}return this.normalizedValuesCache.set(t,s),s}buildCombinedNormalizedValues(e,t){const s=new Array(e.length);for(let i=0;i<e.length;i++)s[i]=this.buildCombinedNormalizedValue(e[i],t);return this.combinedNormalizedValuesCache={fieldsKey:t.join("\0"),values:s},s}buildCombinedNormalizedValue(e,t){let s="";for(let i=0;i<t.length;i++){const n=e[t[i]];"string"==typeof n&&(s&&(s+="\n"),s+=n.toLowerCase())}return s}getCombinedNormalizedValues(e,t){if(e!==this.dataset)return null;const s=t.join("\0");return this.combinedNormalizedValuesCache?.fieldsKey===s?this.combinedNormalizedValuesCache.values:this.buildCombinedNormalizedValues(e,t)}invalidateNormalizedValuesCacheEntry(e,t){for(const[s,i]of this.normalizedValuesCache){const n=t[s];i[e]="string"==typeof n?n.toLowerCase():""}if(null!==this.combinedNormalizedValuesCache){const s=this.combinedNormalizedValuesCache.fieldsKey.split("\0");this.combinedNormalizedValuesCache.values[e]=this.buildCombinedNormalizedValue(t,s)}}searchLinearAllFields(e,t,s,i){if(!e.length)return{items:[],indices:[]};const n=this.getLinearSearchFields(e),r=e===this.dataset,l=n.length,a=new Array(l);for(let f=0;f<l;f++){const t=n[f],s=this.flatIndexes.get(t);if(s)a[f]=s.normalizedValues;else{const s=this.normalizedValuesCache.get(t);a[f]=s||(r?this.buildNormalizedValuesOnly(e,t):null)}}const o=this.nestedCollection.hasRegisteredFields(),d=o?null:this.getCombinedNormalizedValues(e,n),h=!o&&a.every(e=>null!==e),u=[];let c=0;if(null!==s){const e=this.dataset;if(null!==d){for(let e=0;e<s.length;e++){const n=s[e];if(d[n]?.includes(t))if(c<i.offset)c+=1;else if(u.push(n),c+=1,this.hasReachedWindowLimit(i,u.length))break}return this.materializeIndicesResult(u)}if(h){for(let e=0;e<s.length;e++){const n=s[e];let r=!1;for(let e=0;e<l;e++){const s=a[e][n];if(s&&s.includes(t)){r=!0;break}}if(r)if(c<i.offset)c+=1;else if(u.push(n),c+=1,this.hasReachedWindowLimit(i,u.length))break}return this.materializeIndicesResult(u)}for(let r=0;r<s.length;r++){const d=s[r],h=e[d];let f=!1;for(let e=0;e<l;e++){const s=a[e];if(s){const e=s[d];if(e&&e.includes(t)){f=!0;break}}else{const s=h[n[e]];if("string"==typeof s&&s.toLowerCase().includes(t)){f=!0;break}}}if(!f&&o&&(f=this.nestedCollection.matchesAnyField(h,t)),f)if(c<i.offset)c+=1;else if(u.push(d),c+=1,this.hasReachedWindowLimit(i,u.length))break}return this.materializeIndicesResult(u)}if(null!==d){for(let s=0;s<e.length;s++)if(d[s]?.includes(t))if(c<i.offset)c+=1;else if(u.push(s),c+=1,this.hasReachedWindowLimit(i,u.length))break;return this.materializeIndicesResult(u)}if(h){for(let s=0;s<e.length;s++){let e=!1;for(let i=0;i<l;i++){const n=a[i][s];if(n&&n.includes(t)){e=!0;break}}if(e)if(c<i.offset)c+=1;else if(u.push(s),c+=1,this.hasReachedWindowLimit(i,u.length))break}return this.materializeIndicesResult(u)}for(let f=0;f<e.length;f++){const s=e[f];let r=!1;for(let e=0;e<l;e++){const i=a[e];if(i){const e=i[f];if(e&&e.includes(t)){r=!0;break}}else{const i=s[n[e]];if("string"==typeof i&&i.toLowerCase().includes(t)){r=!0;break}}}if(!r&&o&&(r=this.nestedCollection.matchesAnyField(s,t)),r)if(c<i.offset)c+=1;else if(u.push(f),c+=1,this.hasReachedWindowLimit(i,u.length))break}return this.materializeIndicesResult(u)}searchLinearSingleField(e,t,s,i,n){if(!e.length)return{items:[],indices:[]};if(this.nestedCollection.hasField(t)){const r=this.nestedCollection.searchFieldLinearIndices(e,t,s,i??void 0);return this.collectItemsFromIndices(r,n)}const r=[],l=this.flatIndexes.get(t),a=l?l.normalizedValues:this.normalizedValuesCache.get(t)??(e===this.dataset?this.buildNormalizedValuesOnly(e,t):null);let o=0;if(null!==i){const e=this.dataset;if(a){for(let e=0;e<i.length;e++){const t=i[e];if(a[t]?.includes(s))if(o<n.offset)o+=1;else if(r.push(t),o+=1,this.hasReachedWindowLimit(n,r.length))break}return this.materializeIndicesResult(r)}for(let l=0;l<i.length;l++){const a=i[l],d=e[a];if("string"==typeof d[t]&&d[t].toLowerCase().includes(s))if(o<n.offset)o+=1;else if(r.push(a),o+=1,this.hasReachedWindowLimit(n,r.length))break}return this.materializeIndicesResult(r)}if(a){for(let t=0;t<e.length;t++)if(a[t]?.includes(s))if(o<n.offset)o+=1;else if(r.push(t),o+=1,this.hasReachedWindowLimit(n,r.length))break;return this.materializeIndicesResult(r)}for(let d=0;d<e.length;d++)if("string"==typeof e[d][t]&&e[d][t].toLowerCase().includes(s))if(o<n.offset)o+=1;else if(r.push(d),o+=1,this.hasReachedWindowLimit(n,r.length))break;return this.materializeIndicesResult(r)}clearIndexes(){return this.flatIndexes.clear(),this.nestedCollection.clearIndexes(),this.normalizedValuesCache.clear(),this.combinedNormalizedValuesCache=null,this}getOriginData(){return this.state.getOriginData()}data(e){return this.state.data(e),this}add(e){return this.state.add(e),this}update(e){return this.state.update(e),this}applyAddedItems(e,t){if(0===e.length)return this;for(const s of this.indexedFields)this.addItemsToField(s,e,t);return this.nestedCollection.addItems(e,t),this}clearData(){return this.state.clearData(),this}handleStateMutation(e){if(!this.shouldDeferMutationIndexUpdates()||"add"!==e.type&&"update"!==e.type)switch(e.type){case"add":this.applyAddedItems(e.items,e.startIndex);for(const[t,s]of this.normalizedValuesCache)for(let i=0;i<e.items.length;i++){const n=e.items[i][t];s[e.startIndex+i]="string"==typeof n?n.toLowerCase():""}return this.combinedNormalizedValuesCache=null,void this.clearPreviousSearchState();case"update":return this.applyUpdatedItem(e.index,e.previousItem,e.nextItem),this.invalidateNormalizedValuesCacheEntry(e.index,e.nextItem),void this.clearPreviousSearchState();case"data":return this.runtime.deferredMutationVersion=null,this.rebuildConfiguredIndexes(),this.combinedNormalizedValuesCache=null,void this.clearPreviousSearchState();case"clearData":return this.runtime.deferredMutationVersion=null,this.flatIndexes.clear(),this.nestedCollection.clearIndexes(),this.cachedLinearSearchFieldsList=null,this.normalizedValuesCache.clear(),this.combinedNormalizedValuesCache=null,void this.clearPreviousSearchState();case"remove":return this.applyRemovedItem(e.removedItem,e.removedIndex,e.movedItem,e.movedFromIndex),this.cachedLinearSearchFieldsList=null,this.normalizedValuesCache.clear(),this.combinedNormalizedValuesCache=null,void this.clearPreviousSearchState();case"removeMany":for(let t=0;t<e.entries.length;t++){const s=e.entries[t];this.applyRemovedItem(s.removedItem,s.removedIndex,s.movedItem,s.movedFromIndex)}return this.cachedLinearSearchFieldsList=null,this.normalizedValuesCache.clear(),this.combinedNormalizedValuesCache=null,void this.clearPreviousSearchState()}else this.markDeferredMutationState()}addItemsToField(e,t,s){const i=this.flatIndexes.get(e);if(!i)return;const{ngramMap:n,normalizedValues:r}=i;for(let a=0;a<t.length;a++){const i=t[a][e];if("string"!=typeof i)continue;const o=i.toLowerCase(),d=s+a;r[d]=o,l(n,o,d)}i.version=this.state.getMutationVersion()}applyUpdatedItem(e,t,s){for(const i of this.indexedFields)this.updateIndexedField(i,e,t,s);this.nestedCollection.updateItem(s,t,e)}applyRemovedItem(e,t,s,i){for(const n of this.indexedFields)this.removeIndexedFieldValue(n,e,t),null!==s&&null!==i&&this.moveIndexedFieldValue(n,s,i,t);this.nestedCollection.removeItem(e,t),null!==s&&null!==i&&this.nestedCollection.moveItem(s,i,t)}updateIndexedField(e,t,s,i){const n=this.flatIndexes.get(e);if(!n)return;if(s[e]===i[e])return void(n.version=this.state.getMutationVersion());const{ngramMap:r,normalizedValues:a}=n,o=this.getNormalizedFieldValue(s,e);o&&d(r,o,t);const h=this.getNormalizedFieldValue(i,e);if(!h)return delete a[t],void(n.version=this.state.getMutationVersion());a[t]=h,l(r,h,t),n.version=this.state.getMutationVersion()}removeIndexedFieldValue(e,t,s){const i=this.flatIndexes.get(e);if(!i)return;const{ngramMap:n,normalizedValues:r}=i,l=this.getNormalizedFieldValue(t,e);l&&d(n,l,s),delete r[s],i.version=this.state.getMutationVersion()}moveIndexedFieldValue(e,t,s,i){if(s===i)return;const n=this.flatIndexes.get(e);if(!n)return;const{ngramMap:r,normalizedValues:a}=n,o=a[s]??this.getNormalizedFieldValue(t,e);if(!o)return delete a[s],void(n.version=this.state.getMutationVersion());d(r,o,s),l(r,o,i),a[i]=o,delete a[s],n.version=this.state.getMutationVersion()}getNormalizedFieldValue(e,t){const s=e[t];return"string"==typeof s?s.toLowerCase():null}};export{c as TextSearchEngine};
@@ -1,4 +1,55 @@
1
- export { SortEngine } from "./sorter";
2
- export type { SortEngineOptions } from "./types";
3
- export type { CollectionItem, SortDescriptor, SortDirection } from "../types";
4
- //# sourceMappingURL=index.d.ts.map
1
+ import { S as State } from '../State-CYIe-3He.js';
2
+ import { C as CollectionItem, U as UpdateDescriptor, d as SortDescriptor } from '../types-DONld7xY.js';
3
+ export { e as SortDirection } from '../types-DONld7xY.js';
4
+
5
+ interface SortEngineOptions<T extends CollectionItem = CollectionItem> {
6
+ data?: T[];
7
+ fields?: (keyof T & string)[];
8
+ }
9
+
10
+ declare class SortEngine<T extends CollectionItem> {
11
+ private readonly state;
12
+ private readonly namespace;
13
+ constructor(options?: SortEngineOptions<T> & {
14
+ state?: State<T>;
15
+ });
16
+ private get dataset();
17
+ private get runtime();
18
+ private get cache();
19
+ private get indexedFields();
20
+ private shouldDeferMutationCacheUpdates;
21
+ private invalidateCachedIndexes;
22
+ private rebuildConfiguredIndexes;
23
+ private buildIndexForDataset;
24
+ private buildIndexFromData;
25
+ clearIndexes(): this;
26
+ clearData(): this;
27
+ data(data: T[]): this;
28
+ add(items: T[]): this;
29
+ update(descriptor: UpdateDescriptor<T>): this;
30
+ private applyAddedItems;
31
+ getOriginData(): T[];
32
+ private handleStateMutation;
33
+ sort(descriptors: SortDescriptor<T>[]): T[];
34
+ sort(data: T[], descriptors: SortDescriptor<T>[], inPlace?: boolean): T[];
35
+ private sortNumericFastPath;
36
+ private sortMultiField;
37
+ private sortTieGroups;
38
+ private materializeItemsFromIndexes;
39
+ private getCachedSortedItems;
40
+ private shouldMaintainIncrementally;
41
+ private hasDuplicateValuesForIndexes;
42
+ private compareIndexesByField;
43
+ private applyUpdatedItem;
44
+ private updateCachedIndexForUpdatedItem;
45
+ private updateCachedIndexForAddedItems;
46
+ private applyRemovedItem;
47
+ private applyRemovedItemsBatch;
48
+ private updateCachedIndexForRemovedItem;
49
+ private updateUniqueCachedIndexForRemovedItem;
50
+ private updateUniqueCachedIndexForRemovedItems;
51
+ private buildComparator;
52
+ }
53
+
54
+ export { CollectionItem, SortDescriptor, SortEngine };
55
+ export type { SortEngineOptions };
@@ -1,2 +1 @@
1
- import { SortEngine as e } from "./sorter.mjs";
2
- export { e as SortEngine };
1
+ import{a as e,i as t,r as s}from"../chunks/constants-BXQI1M5E.mjs";var n=class e extends Error{constructor(e){super(e),this.name="SortEngineError"}static missingDatasetForSort(){return new e("SortEngine: no dataset in memory.")}};function i(e,t){for(let s=0;s<t;s++){const t=e[s];if(t!==t>>>0)return!1}return!0}function a(e,t,s){const n=new Uint32Array(s),i=new Uint32Array(65536);for(let r=0;r<s;r++)i[65535&t[e[r]]]++;let a=0;for(let r=0;r<65536;r++){const e=i[r];i[r]=a,a+=e}for(let r=0;r<s;r++)n[i[65535&t[e[r]]]++]=e[r];i.fill(0);for(let r=0;r<s;r++)i[t[n[r]]>>>16&65535]++;a=0;for(let r=0;r<65536;r++){const e=i[r];i[r]=a,a+=e}for(let r=0;r<s;r++)e[i[t[n[r]]>>>16&65535]++]=n[r]}var r=()=>({indexedFields:/* @__PURE__ */new Set,cache:/* @__PURE__ */new Map}),d=class{constructor(t={}){if(this.state=t.state??new e(t.data??[]),this.namespace=this.state.createNamespace("sort"),this.state.subscribe(e=>this.handleStateMutation(e)),t.fields?.length){for(const e of t.fields)this.indexedFields.add(e);this.dataset.length>0&&this.rebuildConfiguredIndexes()}}get dataset(){return this.state.getOriginData()}get runtime(){return this.state.getOrCreateScopedValue(this.namespace,"runtime",r)}get cache(){return this.runtime.cache}get indexedFields(){return this.runtime.indexedFields}shouldDeferMutationCacheUpdates(){return!0===this.state.getScopedValue(t,s)}invalidateCachedIndexes(){for(const e of this.indexedFields)this.cache.delete(e)}rebuildConfiguredIndexes(){this.cache.clear();for(const e of this.indexedFields)this.buildIndexForDataset(e)}buildIndexForDataset(e){this.dataset.length&&this.buildIndexFromData(this.dataset,e)}buildIndexFromData(e,t){const s=e.length,n=new Uint32Array(s);for(let i=0;i<s;i++)n[i]=i;let r=0;for(;r<s&&null==e[r][t];)r++;if(r<s&&"number"==typeof e[r][t]){const r=new Float64Array(s);for(let n=0;n<s;n++)r[n]=e[n][t];i(r,s)?a(n,r,s):n.sort((e,t)=>r[e]-r[t])}else{const i=new Array(s);for(let n=0;n<s;n++)i[n]=e[n][t];n.sort((e,t)=>{const s=i[e],n=i[t];return s<n?-1:s>n?1:0})}const d=new Uint32Array(s);for(let i=0;i<s;i++)d[n[i]]=i;this.cache.set(t,{indexes:n,reverseIndex:d,ascItems:null,descItems:null,hasDuplicateValues:this.hasDuplicateValuesForIndexes(e,n,t),version:this.state.getMutationVersion()})}clearIndexes(){return this.cache.clear(),this}clearData(){return this.state.clearData(),this}data(e){return this.state.data(e),this}add(e){return this.state.add(e),this}update(e){return this.state.update(e),this}applyAddedItems(e,t){if(0===t)return this;if(this.shouldDeferMutationCacheUpdates())return this.invalidateCachedIndexes(),this;for(const s of this.indexedFields){const n=this.cache.get(s);n&&(this.shouldMaintainIncrementally(n)?this.updateCachedIndexForAddedItems(s,e,t):this.cache.delete(s))}return this}getOriginData(){return this.state.getOriginData()}handleStateMutation(e){switch(e.type){case"add":return void this.applyAddedItems(e.startIndex,e.items.length);case"update":return void this.applyUpdatedItem(e.index,e.previousItem,e.nextItem);case"data":return void this.rebuildConfiguredIndexes();case"clearData":return void this.cache.clear();case"remove":return void this.applyRemovedItem(e.removedIndex,e.movedFromIndex);case"removeMany":return void this.applyRemovedItemsBatch(e.entries)}}sort(e,t,s=!1){const i=void 0===t;let a,r;if(i){if(!this.dataset.length)throw n.missingDatasetForSort();a=this.dataset,r=e}else a=e,r=t;if(0===r.length||0===a.length)return a;if(1===r.length){const{field:e,direction:t}=r[0];if(i&&this.indexedFields.has(e)){let s=this.cache.get(e);const n=this.state.getMutationVersion();return s&&s.version===n||(this.buildIndexForDataset(e),s=this.cache.get(e)),this.getCachedSortedItems(s,t)}return this.sortNumericFastPath(a,e,t,s)}return this.sortMultiField(a,r,s,i)}sortNumericFastPath(e,t,s,n){if(0===e.length||"number"!=typeof e[0][t]){const i=n?e:e.slice();return i.sort((e,n)=>{const i=e[t],a=n[t],r=i<a?-1:i>a?1:0;return"asc"===s?r:-r}),i}const r=e.length,d=new Float64Array(r);for(let i=0;i<r;i++)d[i]=e[i][t];const o=new Uint32Array(r);for(let i=0;i<r;i++)o[i]=i;return i(d,r)?a(o,d,r):o.sort((e,t)=>d[e]-d[t]),this.materializeItemsFromIndexes(e,o,s)}sortMultiField(e,t,s,n){const[i,...a]=t;if(n&&this.indexedFields.has(i.field)){let e=this.cache.get(i.field);const t=this.state.getMutationVersion();e&&e.version===t||(this.buildIndexForDataset(i.field),e=this.cache.get(i.field));const s=e.hasDuplicateValues?this.getCachedSortedItems(e,i.direction).slice():this.getCachedSortedItems(e,i.direction);return e.hasDuplicateValues?this.sortTieGroups(s,i.field,a):s}const r=s?e:e.slice(),d=this.buildComparator(t);return r.sort(d),r}sortTieGroups(e,t,s){if(0===s.length)return e;const n=this.buildComparator(s),i=e.length;let a=0;for(;a<i;){let s=a+1;const r=e[a][t];for(;s<i&&e[s][t]===r;)s++;if(s-a>1){const t=e.slice(a,s);t.sort(n);for(let n=a;n<s;n++)e[n]=t[n-a]}a=s}return e}materializeItemsFromIndexes(e,t,s){const n=t.length,i=new Array(n);if("asc"===s){for(let s=0;s<n;s++)i[s]=e[t[s]];return i}for(let a=0;a<n;a++)i[a]=e[t[n-1-a]];return i}getCachedSortedItems(e,t){return"asc"===t?(null===e.ascItems&&(e.ascItems=this.materializeItemsFromIndexes(this.dataset,e.indexes,"asc")),e.ascItems):(null!==e.descItems||(e.descItems=this.getCachedSortedItems(e,"asc").slice().reverse()),e.descItems)}shouldMaintainIncrementally(e){return null!==e.ascItems||null!==e.descItems}hasDuplicateValuesForIndexes(e,t,s){for(let n=1;n<t.length;n++)if(e[t[n-1]][s]===e[t[n]][s])return!0;return!1}compareIndexesByField(e,t,s){const n=this.dataset[t][e],i=this.dataset[s][e];if("number"==typeof n&&"number"==typeof i){const e=n-i;if(0!==e)return e}else{if(n<i)return-1;if(n>i)return 1}return t-s}applyUpdatedItem(e,t,s){if(this.shouldDeferMutationCacheUpdates())this.invalidateCachedIndexes();else for(const n of this.indexedFields){if(t[n]===s[n])continue;const i=this.cache.get(n);i&&(this.shouldMaintainIncrementally(i)?this.updateCachedIndexForUpdatedItem(n,e):this.cache.delete(n))}}updateCachedIndexForUpdatedItem(e,t){const s=this.cache.get(e);if(!s)return;const{indexes:n,reverseIndex:i}=s,a=n.length,r=i[t];if(r>=a||n[r]!==t)return void this.cache.delete(e);n.copyWithin(r,r+1);const d=a-1;let o=0,l=d;for(;o<l;){const s=o+l>>1;this.compareIndexesByField(e,n[s],t)<=0?o=s+1:l=s}const h=o;n.copyWithin(h+1,h,d),n[h]=t,null!==s.ascItems&&(s.ascItems.copyWithin(r,r+1),s.ascItems.copyWithin(h+1,h,d),s.ascItems[h]=this.dataset[t]);const c=Math.min(r,h),u=Math.max(r,h);for(let m=c;m<=u;m++)i[n[m]]=m;if(s.descItems=null,!s.hasDuplicateValues){const i=h>0?n[h-1]:-1,r=h+1<a?n[h+1]:-1;s.hasDuplicateValues=-1!==i&&this.dataset[i][e]===this.dataset[t][e]||-1!==r&&this.dataset[r][e]===this.dataset[t][e]}s.version=this.state.getMutationVersion()}updateCachedIndexForAddedItems(e,t,s){const n=this.cache.get(e);if(!n)return;const i=new Array(s);for(let u=0;u<s;u++)i[u]=t+u;i.sort((t,s)=>this.compareIndexesByField(e,t,s));const a=new Uint32Array(n.indexes.length+s);let r=-1,d=n.hasDuplicateValues,o=0,l=0,h=0;for(;o<n.indexes.length&&l<i.length;){const t=this.compareIndexesByField(e,n.indexes[o],i[l])<=0?n.indexes[o++]:i[l++];a[h]=t,d||-1===r||this.dataset[r][e]!==this.dataset[t][e]||(d=!0),r=t,h+=1}for(;o<n.indexes.length;){const t=n.indexes[o++];a[h]=t,d||-1===r||this.dataset[r][e]!==this.dataset[t][e]||(d=!0),r=t,h+=1}for(;l<i.length;){const t=i[l++];a[h]=t,d||-1===r||this.dataset[r][e]!==this.dataset[t][e]||(d=!0),r=t,h+=1}const c=new Uint32Array(a.length);for(let u=0;u<a.length;u++)c[a[u]]=u;n.indexes=a,n.reverseIndex=c,n.ascItems=n.ascItems?this.materializeItemsFromIndexes(this.dataset,a,"asc"):null,n.descItems=null,n.hasDuplicateValues=d,n.version=this.state.getMutationVersion()}applyRemovedItem(e,t){if(this.shouldDeferMutationCacheUpdates())this.invalidateCachedIndexes();else for(const s of this.indexedFields){const n=this.cache.get(s);n&&(this.shouldMaintainIncrementally(n)?this.updateCachedIndexForRemovedItem(s,e,t):this.cache.delete(s))}}applyRemovedItemsBatch(e){if(this.shouldDeferMutationCacheUpdates())this.invalidateCachedIndexes();else for(const t of this.indexedFields){const s=this.cache.get(t);s&&(this.shouldMaintainIncrementally(s)?s.hasDuplicateValues?this.cache.delete(t):(this.updateUniqueCachedIndexForRemovedItems(s,e),s.version=this.state.getMutationVersion()):this.cache.delete(t))}}updateCachedIndexForRemovedItem(e,t,s){const n=this.cache.get(e);if(!n)return;if(!n.hasDuplicateValues)return this.updateUniqueCachedIndexForRemovedItem(n,t,s),void(n.version=this.state.getMutationVersion());const i=[];for(let d=0;d<n.indexes.length;d++){const e=n.indexes[d];e!==t&&e!==s&&i.push(e)}if(null!==s&&s!==t){let s=0,n=i.length;for(;s<n;){const a=s+n>>1;this.compareIndexesByField(e,i[a],t)<=0?s=a+1:n=a}i.splice(s,0,t)}const a=Uint32Array.from(i),r=new Uint32Array(this.dataset.length);for(let d=0;d<a.length;d++)r[a[d]]=d;n.indexes=a,n.reverseIndex=r,n.ascItems=n.ascItems?this.materializeItemsFromIndexes(this.dataset,a,"asc"):null,n.descItems=null,n.hasDuplicateValues=!!n.hasDuplicateValues&&this.hasDuplicateValuesForIndexes(this.dataset,a,e),n.version=this.state.getMutationVersion()}updateUniqueCachedIndexForRemovedItem(e,t,s){const n=e.indexes.length-1,i=new Uint32Array(n),a=new Uint32Array(this.dataset.length),r=null!==e.ascItems?new Array(n):null;let d=0;for(let o=0;o<e.indexes.length;o++){const n=e.indexes[o];if(n===t)continue;const l=null!==s&&n===s?t:n;i[d]=l,a[l]=d,null!==r&&(r[d]=this.dataset[l]),d+=1}e.indexes=i,e.reverseIndex=a,e.ascItems=r,e.descItems=null}updateUniqueCachedIndexForRemovedItems(e,t){const s=e.indexes.length,n=new Uint32Array(s),i=new Int32Array(s);for(let h=0;h<s;h++)n[h]=h,i[h]=-1;let a=s;for(let h=0;h<t.length;h++){const e=t[h];null!==e.movedFromIndex&&(n[e.removedIndex]=n[e.movedFromIndex]),a-=1}const r=new Uint32Array(a),d=new Uint32Array(a),o=null!==e.ascItems?new Array(a):null;for(let h=0;h<a;h++)i[n[h]]=h;let l=0;for(let h=0;h<e.indexes.length;h++){const t=i[e.indexes[h]];-1!==t&&(r[l]=t,d[t]=l,null!==o&&(o[l]=this.dataset[t]),l+=1)}e.indexes=r,e.reverseIndex=d,e.ascItems=o,e.descItems=null}buildComparator(e){const t=e.map(({field:e})=>e),s=e.map(({direction:e})=>"asc"===e?1:-1),n=t.length;return(e,i)=>{for(let a=0;a<n;a++){const n=t[a],r=e[n],d=i[n];if(r<d)return-s[a];if(r>d)return s[a]}return 0}}};export{d as SortEngine};
@@ -0,0 +1,74 @@
1
+ type CollectionItem = Record<string, any>;
2
+ type IndexableKey<T> = {
3
+ [K in keyof T]: T[K] extends string | number ? K : never;
4
+ }[keyof T];
5
+ interface UpdateDescriptor<T extends CollectionItem> {
6
+ field: IndexableKey<T> & string;
7
+ data: T;
8
+ }
9
+ interface FilterCriterion<T extends CollectionItem> {
10
+ field: (keyof T & string) | (string & {});
11
+ values?: any[];
12
+ exclude?: any[];
13
+ }
14
+ type SortDirection = "asc" | "desc";
15
+ interface SortDescriptor<T extends CollectionItem> {
16
+ field: keyof T & string;
17
+ direction: SortDirection;
18
+ }
19
+ type StateListener<T extends CollectionItem> = (mutation: StateMutation<T>) => void;
20
+ interface StateRegistryFactory<TValue> {
21
+ (): TValue;
22
+ }
23
+ interface StateOptions {
24
+ filterByPreviousResult?: boolean;
25
+ }
26
+ interface StatePreviousResult<T extends CollectionItem> {
27
+ result: T[];
28
+ sourceData: T[];
29
+ version: number;
30
+ }
31
+ type StateAddMutation<T extends CollectionItem> = {
32
+ type: "add";
33
+ items: T[];
34
+ startIndex: number;
35
+ };
36
+ type StateUpdateMutation<T extends CollectionItem> = {
37
+ type: "update";
38
+ field: IndexableKey<T> & string;
39
+ index: number;
40
+ previousItem: T;
41
+ nextItem: T;
42
+ };
43
+ type StateDataMutation<T extends CollectionItem> = {
44
+ type: "data";
45
+ data: T[];
46
+ };
47
+ type StateClearMutation<T extends CollectionItem> = {
48
+ type: "clearData";
49
+ data: T[];
50
+ };
51
+ type StateRemoveMutation<T extends CollectionItem> = {
52
+ type: "remove";
53
+ field: IndexableKey<T> & string;
54
+ value: T[IndexableKey<T> & string];
55
+ removedItem: T;
56
+ removedIndex: number;
57
+ movedItem: T | null;
58
+ movedFromIndex: number | null;
59
+ };
60
+ type StateRemoveManyEntry<T extends CollectionItem> = {
61
+ value: T[IndexableKey<T> & string];
62
+ removedItem: T;
63
+ removedIndex: number;
64
+ movedItem: T | null;
65
+ movedFromIndex: number | null;
66
+ };
67
+ type StateRemoveManyMutation<T extends CollectionItem> = {
68
+ type: "removeMany";
69
+ field: IndexableKey<T> & string;
70
+ entries: StateRemoveManyEntry<T>[];
71
+ };
72
+ type StateMutation<T extends CollectionItem> = StateAddMutation<T> | StateUpdateMutation<T> | StateDataMutation<T> | StateClearMutation<T> | StateRemoveMutation<T> | StateRemoveManyMutation<T>;
73
+
74
+ export type { CollectionItem as C, FilterCriterion as F, IndexableKey as I, StateOptions as S, UpdateDescriptor as U, StateListener as a, StatePreviousResult as b, StateRegistryFactory as c, SortDescriptor as d, SortDirection as e };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devisfuture/mega-collection",
3
- "version": "2.4.7",
3
+ "version": "2.4.8",
4
4
  "description": "High-performance search, filter & sort engine for 100K+ item collections in JavaScript/TypeScript",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {
@@ -33,7 +33,7 @@
33
33
  ],
34
34
  "sideEffects": false,
35
35
  "scripts": {
36
- "build:types": "tsc --emitDeclarationOnly",
36
+ "build:types": "rollup -c rollup.types.config.mjs",
37
37
  "build": "vite build && npm run build:types",
38
38
  "build:watch": "vite build --watch",
39
39
  "dev": "vite build --watch",
@@ -84,6 +84,9 @@
84
84
  "devDependencies": {
85
85
  "@types/node": "^25.5.0",
86
86
  "@vitest/coverage-v8": "^4.1.0",
87
+ "rollup": "^4.52.3",
88
+ "rollup-plugin-dts": "^6.2.3",
89
+ "terser": "^5.46.1",
87
90
  "typescript": "^5.3.0",
88
91
  "vite": "^8.0.0",
89
92
  "vitest": "^4.1.0"
package/dist/State.mjs DELETED
@@ -1,183 +0,0 @@
1
- //#region src/State.ts
2
- var e = class {
3
- constructor(e = [], t = {}) {
4
- this.itemIndexLookup = /* @__PURE__ */ new WeakMap(), this.mutationVersion = 0, this.namespaceSequence = 0, this.previousResultState = null, this.indexMaps = /* @__PURE__ */ new Map(), this.scopedRegistry = /* @__PURE__ */ new Map(), this.listeners = /* @__PURE__ */ new Set(), this.originData = e, this.filterByPreviousResult = t.filterByPreviousResult ?? !1, this.rebuildItemIndexLookup();
5
- }
6
- subscribe(e) {
7
- return this.listeners.add(e), () => {
8
- this.listeners.delete(e);
9
- };
10
- }
11
- getOriginData() {
12
- return this.originData;
13
- }
14
- getItemIndex(e) {
15
- return this.itemIndexLookup.get(e);
16
- }
17
- getMutationVersion() {
18
- return this.mutationVersion;
19
- }
20
- isFilterByPreviousResultEnabled() {
21
- return this.filterByPreviousResult;
22
- }
23
- setFilterByPreviousResult(e) {
24
- this.filterByPreviousResult = e, e || this.clearPreviousResult();
25
- }
26
- getPreviousResult() {
27
- return this.getPreviousResultState()?.result ?? null;
28
- }
29
- getPreviousResultState() {
30
- return this.previousResultState === null || this.previousResultState.version !== this.mutationVersion ? null : this.previousResultState;
31
- }
32
- setPreviousResult(e, t) {
33
- this.previousResultState = {
34
- result: e,
35
- sourceData: t,
36
- version: this.mutationVersion
37
- };
38
- }
39
- clearPreviousResult() {
40
- this.previousResultState = null;
41
- }
42
- createNamespace(e = "scope") {
43
- return this.namespaceSequence += 1, `${e}:${this.namespaceSequence}`;
44
- }
45
- getScopedValue(e, t) {
46
- return this.scopedRegistry.get(e)?.get(t);
47
- }
48
- getOrCreateScopedValue(e, t, n) {
49
- let r = this.getScopedValue(e, t);
50
- if (r !== void 0) return r;
51
- let i = this.getOrCreateScope(e), a = n();
52
- return i.set(t, a), a;
53
- }
54
- setScopedValue(e, t, n) {
55
- return this.getOrCreateScope(e).set(t, n), n;
56
- }
57
- deleteScopedValue(e, t) {
58
- let n = this.scopedRegistry.get(e);
59
- n && (n.delete(t), n.size === 0 && this.scopedRegistry.delete(e));
60
- }
61
- clearScope(e) {
62
- this.scopedRegistry.delete(e);
63
- }
64
- data(e) {
65
- this.originData = e, this.bumpMutationVersion(), this.rebuildItemIndexLookup();
66
- for (let e of this.indexMaps.keys()) this.rebuildIndexMap(e);
67
- this.emit({
68
- type: "data",
69
- data: e
70
- });
71
- }
72
- add(e) {
73
- if (e.length === 0) return;
74
- let t = this.originData.length;
75
- for (let n = 0; n < e.length; n++) this.originData.push(e[n]), this.itemIndexLookup.set(e[n], t + n);
76
- this.bumpMutationVersion();
77
- for (let [n, r] of this.indexMaps) for (let i = 0; i < e.length; i++) r.set(e[i][n], t + i);
78
- this.emit({
79
- type: "add",
80
- items: e,
81
- startIndex: t
82
- });
83
- }
84
- update(e) {
85
- let { field: t, data: n } = e, r = n[t];
86
- if (r == null) return;
87
- let i = this.getOrCreateIndexMap(t).get(r);
88
- if (i === void 0) return;
89
- let a = this.originData[i];
90
- this.originData[i] = n, this.itemIndexLookup.delete(a), this.itemIndexLookup.set(n, i), this.bumpMutationVersion();
91
- for (let [e, t] of this.indexMaps) {
92
- let r = a[e], o = n[e];
93
- r !== o && (t.get(r) === i && t.delete(r), t.set(o, i));
94
- }
95
- this.emit({
96
- type: "update",
97
- field: t,
98
- index: i,
99
- previousItem: a,
100
- nextItem: n
101
- });
102
- }
103
- clearData() {
104
- let e = [];
105
- this.originData = e, this.itemIndexLookup = /* @__PURE__ */ new WeakMap(), this.bumpMutationVersion();
106
- for (let e of this.indexMaps.values()) e.clear();
107
- this.emit({
108
- type: "clearData",
109
- data: e
110
- });
111
- }
112
- removeByFieldValue(e, t) {
113
- let n = this.getOrCreateIndexMap(e).get(t);
114
- if (n === void 0) return;
115
- let r = this.originData.length - 1, i = this.originData[n], a = n === r ? null : this.originData[r];
116
- n !== r && a && (this.originData[n] = a, this.itemIndexLookup.set(a, n)), this.originData.pop(), this.itemIndexLookup.delete(i), this.bumpMutationVersion();
117
- for (let [e, t] of this.indexMaps) {
118
- let r = i[e];
119
- t.get(r) === n && t.delete(r), a && t.set(a[e], n);
120
- }
121
- this.emit({
122
- type: "remove",
123
- field: e,
124
- value: t,
125
- removedItem: i,
126
- removedIndex: n,
127
- movedItem: a,
128
- movedFromIndex: a ? r : null
129
- });
130
- }
131
- removeByFieldValues(e, t) {
132
- if (t.length === 0) return;
133
- let n = this.getOrCreateIndexMap(e), r = [];
134
- for (let e = 0; e < t.length; e++) {
135
- let i = t[e], a = n.get(i);
136
- if (a === void 0) continue;
137
- let o = this.originData.length - 1, s = this.originData[a], c = a === o ? null : this.originData[o];
138
- a !== o && c && (this.originData[a] = c, this.itemIndexLookup.set(c, a)), this.originData.pop(), this.itemIndexLookup.delete(s);
139
- for (let [e, t] of this.indexMaps) {
140
- let n = s[e];
141
- t.get(n) === a && t.delete(n), c && t.set(c[e], a);
142
- }
143
- r.push({
144
- value: i,
145
- removedItem: s,
146
- removedIndex: a,
147
- movedItem: c,
148
- movedFromIndex: c ? o : null
149
- });
150
- }
151
- r.length !== 0 && (this.bumpMutationVersion(), this.emit({
152
- type: "removeMany",
153
- field: e,
154
- entries: r
155
- }));
156
- }
157
- emit(e) {
158
- for (let t of this.listeners) t(e);
159
- }
160
- getOrCreateScope(e) {
161
- let t = this.scopedRegistry.get(e);
162
- if (t) return t;
163
- let n = /* @__PURE__ */ new Map();
164
- return this.scopedRegistry.set(e, n), n;
165
- }
166
- bumpMutationVersion() {
167
- this.mutationVersion += 1, this.clearPreviousResult();
168
- }
169
- getOrCreateIndexMap(e) {
170
- return this.indexMaps.get(e) || this.rebuildIndexMap(e);
171
- }
172
- rebuildIndexMap(e) {
173
- let t = /* @__PURE__ */ new Map();
174
- for (let n = 0; n < this.originData.length; n++) t.set(this.originData[n][e], n);
175
- return this.indexMaps.set(e, t), t;
176
- }
177
- rebuildItemIndexLookup() {
178
- this.itemIndexLookup = /* @__PURE__ */ new WeakMap();
179
- for (let e = 0; e < this.originData.length; e++) this.itemIndexLookup.set(this.originData[e], e);
180
- }
181
- };
182
- //#endregion
183
- export { e as State };
@@ -1,5 +0,0 @@
1
- export declare const MERGE_SHARED_SCOPE = "__merge__";
2
- export declare const DEFER_FILTER_MUTATION_INDEX_UPDATES_KEY = "deferFilterMutationIndexUpdates";
3
- export declare const DEFER_SEARCH_MUTATION_INDEX_UPDATES_KEY = "deferSearchMutationIndexUpdates";
4
- export declare const DEFER_SORT_MUTATION_CACHE_UPDATES_KEY = "deferSortMutationCacheUpdates";
5
- //# sourceMappingURL=constants.d.ts.map
@@ -1,4 +0,0 @@
1
- //#region src/constants.ts
2
- var e = "__merge__", t = "deferFilterMutationIndexUpdates", n = "deferSearchMutationIndexUpdates", r = "deferSortMutationCacheUpdates";
3
- //#endregion
4
- export { t as DEFER_FILTER_MUTATION_INDEX_UPDATES_KEY, n as DEFER_SEARCH_MUTATION_INDEX_UPDATES_KEY, r as DEFER_SORT_MUTATION_CACHE_UPDATES_KEY, e as MERGE_SHARED_SCOPE };
@@ -1,9 +0,0 @@
1
- import type { CollectionItem } from "../types";
2
- import type { FilterEngineChain, FilterEngineChainCallbacks } from "./types";
3
- export type { FilterEngineChain } from "./types";
4
- export declare class FilterEngineChainBuilder<T extends CollectionItem> {
5
- private readonly callbacks;
6
- constructor(callbacks: FilterEngineChainCallbacks<T>);
7
- create(result: T[]): T[] & FilterEngineChain<T>;
8
- }
9
- //# sourceMappingURL=chain.d.ts.map
@@ -1,22 +0,0 @@
1
- import { createChainMethodDescriptor as e } from "../internal.mjs";
2
- //#region src/filter/chain.ts
3
- var t = class {
4
- constructor(e) {
5
- this.callbacks = e;
6
- }
7
- create(t) {
8
- let n = t;
9
- return Object.defineProperties(n, {
10
- filter: e((e, n) => n === void 0 ? this.callbacks.filter(t, e) : this.callbacks.filter(e, n)),
11
- add: e((e) => this.callbacks.add(e)),
12
- update: e((e) => this.callbacks.update(e)),
13
- clearIndexes: e(() => this.callbacks.clearIndexes()),
14
- data: e((e) => this.callbacks.data(e)),
15
- getOriginData: e(() => this.callbacks.getOriginData()),
16
- clearData: e(() => this.callbacks.clearData()),
17
- resetFilterState: e(() => this.callbacks.resetFilterState())
18
- }), n;
19
- }
20
- };
21
- //#endregion
22
- export { t as FilterEngineChainBuilder };
@@ -1,2 +0,0 @@
1
- export { DEFER_FILTER_MUTATION_INDEX_UPDATES_KEY } from "../constants";
2
- //# sourceMappingURL=constants.d.ts.map
@@ -1,6 +0,0 @@
1
- import type { CollectionItem, FilterCriterion } from "../types";
2
- import type { ResolvedFilterCriterion } from "./types";
3
- export declare function resolveCriteria<T extends CollectionItem>(criteria: FilterCriterion<T>[]): ResolvedFilterCriterion<T>[];
4
- export declare function matchesCriterionValue<T extends CollectionItem>(criterion: ResolvedFilterCriterion<T>, value: any): boolean;
5
- export declare function isCriterionUnsatisfiable<T extends CollectionItem>(criterion: ResolvedFilterCriterion<T>): boolean;
6
- //# sourceMappingURL=criterion.d.ts.map
@@ -1,64 +0,0 @@
1
- //#region src/filter/criterion.ts
2
- function e(e) {
3
- let t = /* @__PURE__ */ new Map();
4
- for (let n = 0; n < e.length; n++) {
5
- let a = e[n], o = Array.isArray(a.values), s = r(a.exclude), c = s !== null, l = o ? i(a.values, s) : null;
6
- if (!o && !c) continue;
7
- let u = a.field, d = t.get(u);
8
- if (!d) {
9
- t.set(u, {
10
- field: a.field,
11
- values: [],
12
- exclude: [],
13
- hasValues: o,
14
- hasExclude: c,
15
- includedValues: l ? new Set(l) : null,
16
- excludedValues: s ? new Set(s) : null,
17
- cacheKeySegment: ""
18
- });
19
- continue;
20
- }
21
- if (o) if (!d.hasValues) d.hasValues = !0, d.includedValues = new Set(l);
22
- else for (let e of d.includedValues) l.has(e) || d.includedValues.delete(e);
23
- if (c) if (!d.hasExclude) d.hasExclude = !0, d.excludedValues = new Set(s);
24
- else for (let e of s) d.excludedValues.add(e);
25
- }
26
- let n = [...t.values()].sort((e, t) => e.field.localeCompare(t.field));
27
- for (let e = 0; e < n.length; e++) a(n[e]);
28
- return n;
29
- }
30
- function t(e, t) {
31
- return !(e.hasValues && !e.includedValues.has(t) || e.hasExclude && e.excludedValues.has(t));
32
- }
33
- function n(e) {
34
- return e.hasValues && e.values.length === 0;
35
- }
36
- function r(e) {
37
- return !Array.isArray(e) || e.length === 0 ? null : new Set(e);
38
- }
39
- function i(e, t) {
40
- let n = /* @__PURE__ */ new Set();
41
- for (let r = 0; r < e.length; r++) {
42
- let i = e[r];
43
- t?.has(i) || n.add(i);
44
- }
45
- return n;
46
- }
47
- function a(e) {
48
- if (e.hasValues && e.hasExclude) for (let t of e.excludedValues) e.includedValues.delete(t);
49
- e.values = e.includedValues ? [...e.includedValues] : [], e.exclude = e.excludedValues ? [...e.excludedValues] : [], e.cacheKeySegment = o(e);
50
- }
51
- function o(e) {
52
- let t = e.field;
53
- return t += `|hv:${e.hasValues ? "1" : "0"}|v:`, e.hasValues && (t += s(e.values)), t += `|hx:${e.hasExclude ? "1" : "0"}|x:`, e.hasExclude && (t += s(e.exclude)), t;
54
- }
55
- function s(e) {
56
- return e.length === 0 ? "" : e.map((e) => c(e)).sort().join(",");
57
- }
58
- function c(e) {
59
- if (e === null) return "null:null";
60
- let t = typeof e;
61
- return t === "object" ? `object:${JSON.stringify(e)}` : `${t}:${String(e)}`;
62
- }
63
- //#endregion
64
- export { n as isCriterionUnsatisfiable, t as matchesCriterionValue, e as resolveCriteria };
@@ -1,7 +0,0 @@
1
- export declare class FilterEngineError extends Error {
2
- constructor(message: string);
3
- static missingDatasetForBuildIndex(): FilterEngineError;
4
- static missingDatasetForFilter(): FilterEngineError;
5
- static duplicateMutableExcludeField(field: string): FilterEngineError;
6
- }
7
- //# sourceMappingURL=errors.d.ts.map
@@ -1,17 +0,0 @@
1
- //#region src/filter/errors.ts
2
- var e = class e extends Error {
3
- constructor(e) {
4
- super(e), this.name = "FilterEngineError";
5
- }
6
- static missingDatasetForBuildIndex() {
7
- return new e("FilterEngine: no dataset in memory. Call data() or add() before buildIndex().");
8
- }
9
- static missingDatasetForFilter() {
10
- return new e("FilterEngine: no dataset in memory. Call data() or add() before filter().");
11
- }
12
- static duplicateMutableExcludeField(t) {
13
- return new e(`FilterEngine: cannot use mutable exclude on field \`${t}\` because it contains duplicate values.`);
14
- }
15
- };
16
- //#endregion
17
- export { e as FilterEngineError };